public ActionResult Edit([Bind(Include = "Id, Price, ActionsTaken, EmployeeId")] EditRepairBindingModel model) { if (ModelState.IsValid) { this.service.EditRepair(model); return(this.RedirectToAction("AllRepairs")); } return(this.RedirectToAction("Edit", "Repairs", new { id = model.Id })); }
public void EditRepair(EditRepairBindingModel model) { Repair repair = this.Context.Repairs.Find(model.Id); if (repair != null) { repair.Price = model.Price; repair.ActionsTaken = model.ActionsTaken; repair.EmployeeInCharge = this.Context.Employees.Find(model.EmployeeId); this.Context.SaveChanges(); } }