2
My project has the Delete method, only it definitely deletes the table record in the database.
I would like to instead of delete, change the column record, I have a field called "Status", this field is an Enum with two options "Enabled = 0" and "Disabled = 1", by default is "Enabled".
How to change his method to change instead of delete?
In Mysql I would use this command to change:
update pessoas set Status = 1 where (Id = 1);
In Controller Delete looks like this:
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult DeleteConfirmed(int id)
{
Pessoas pessoas = db.Pessoas.Find(id);
db.Pessoas.Remove(pessoas);
db.SaveChanges();
return RedirectToAction("Index");
}
LINQ stands for Language Integrated Query, so it makes no sense to use it to make an update, since query is consultation.
– Maniero
But the controller has Create and Edit. What would be the correct name of what I am wanting to do?
– Rodrigo Santos
Any other sewing except LINQ.
– Maniero