public ActionResult EditDebtor(OrganisationDeptor d) { var debtor = db.OrganisationDeptors.Find(d.OrganisationDeptorID); TryUpdateModel<OrganisationDeptor>(debtor); db.Entry<OrganisationDeptor>(debtor).State = System.Data.EntityState.Modified; db.SaveChanges(); return RedirectToAction("Debtors"); }
public ActionResult CreateDebtor(OrganisationDeptor d, int complaintID) { Debug.WriteLine(d.Name); try { d.Complaint = db.Complaints.Find(complaintID); db.OrganisationDeptors.Add(d); db.SaveChanges(); return RedirectToAction("Debtors"); } catch { ViewBag.complaintID = complaintID; return View(); } }