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