public ActionResult Edit(GradeViewModel grade) { if (ModelState.IsValid) { var gradeDomain = Mapper.Map <GradeViewModel, Grade>(grade); _gradeApp.Update(gradeDomain); return(RedirectToAction("Index")); } return(View(grade)); }
public ActionResult Edit(GradeViewModel grade) { if (ModelState.IsValid) { var subjectDomain = Mapper.Map <GradeViewModel, Grade>(grade); _gradeApp.Update(subjectDomain); return(RedirectToAction("Index")); } ViewBag.StudentId = new SelectList(_studentApp.GetAll(), "Id", "Nome", grade.StudentId); ViewBag.SubjectId = new SelectList(_subjectApp.GetAll(), "Id", "Name", grade.SubjectId); return(View(grade)); }