예제 #1
0
 public bool saveAfterEdit(SchoolViewModel schoolVM)
 {
     School school = Mapper.Map<School>(schoolVM);
     db.Entry(school).State = EntityState.Modified;
     db.SaveChanges();
     return true;
 }
예제 #2
0
 public bool createNewSchool(SchoolViewModel schoolVM)
 {
     School schoolmodel = Mapper.Map<School>(schoolVM);
     db.Schools.Add(schoolmodel);
     db.SaveChanges();
     return true;
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }