public bool saveAfterEdit(SchoolViewModel schoolVM) { School school = Mapper.Map<School>(schoolVM); db.Entry(school).State = EntityState.Modified; db.SaveChanges(); return true; }
public bool createNewSchool(SchoolViewModel schoolVM) { School schoolmodel = Mapper.Map<School>(schoolVM); db.Schools.Add(schoolmodel); db.SaveChanges(); return true; }
public ActionResult Create(SchoolViewModel school) { if (ModelState.IsValid) { School schObj = Mapper.Map<School>(school); db.Schools.Add(schObj); db.SaveChanges(); return RedirectToAction("Index"); } return View(school); }
public ActionResult Edit(SchoolViewModel school) { if (ModelState.IsValid) { School schObj = Mapper.Map<School>(school); db.Entry(schObj).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(school); }