public ActionResult Edit(int?id) { InternshipCourse internshipCourse = db.InternshipCourses.Find(id); InternshipCourseViewModel model = Mapper.Map <InternshipCourse, InternshipCourseViewModel>(internshipCourse); return(View(model)); }
public ActionResult Edit(InternshipCourseViewModel model) { if (ModelState.IsValid) { InternshipCourse internshipCourse = Mapper.Map <InternshipCourseViewModel, InternshipCourse>(model); db.Entry(internshipCourse).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Create(InternshipCourseViewModel model) { if (ModelState.IsValid) { InternshipCourse internshipCourse = Mapper.Map <InternshipCourseViewModel, InternshipCourse>(model); db.InternshipCourses.Add(internshipCourse); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }