public ActionResult Edit(SpaceModel data) { bool result = repository.Edit(data); if (result == false) return View(data); return RedirectToAction("Index", "Home"); }
public bool Add(SpaceModel data) { using (var DB = new MainContext()) { DB.Spaces.Add(data); DB.SaveChanges(); return true; } return false; }
public bool Edit(SpaceModel data) { using (var DB = new MainContext()) { DB.Spaces.Attach(data); DB.Entry(data).State = System.Data.Entity.EntityState.Modified; DB.SaveChanges(); return true; } return false; }