public bool Create(Inquiry inquiry) { if (ModelState.IsValid) { inquiry.House = db.Houses.Include("Location").Single(m => m.ID == inquiry.House.ID); inquiry.Status = "Pending"; db.Inquiries.Add(inquiry); db.SaveChanges(); return true; } return false; }
public ActionResult Edit(Inquiry inquiry) { if (ModelState.IsValid) { Inquiry i = db.Inquiries.Include("House").Single(m => m.ID == inquiry.ID); db.Entry(i).CurrentValues.SetValues(inquiry); db.SaveChanges(); Success("Response sent!"); return RedirectToAction("Index"); } Error("Something went wrong! No response was sent"); return View(inquiry); }