1
Answer

MVC4: The resource cannot be found

nizam nizam

nizam nizam

9y
2.7k
1

The resource cannot be found.

what is this error while i deleting a list  
//Get//
public ActionResult Delete(int id=0)
{
var head = db.Payroll_SalaryHeads.Find(id);
if (head == null)
{
return HttpNotFound();
}
return RedirectToAction("Index");
}

..POST// 
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult Delete(int id=0)
{
var head = db.Payroll_SalaryHeads.Find(id);
db.Payroll_SalaryHeads.Remove(head);
db.SaveChanges();
return RedirectToAction("Index");
}
 
Answers (1)