public ActionResult Edit(SubjectViewModel subject) { if (ModelState.IsValid) { var subjectDomain = Mapper.Map <SubjectViewModel, Subject>(subject); _subjectApp.Update(subjectDomain); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(_courseApp.GetAll(), "Id", "Nome", subject.CourseId); ViewBag.TeacherId = new SelectList(_teacherApp.GetAll(), "Id", "Name", subject.TeacherId); return(View(subject)); }
public ResponseBase Edit(Subject subject) { ResponseBase response = new ResponseBase(); try { response.Success = _appService.Update(subject); } catch (LibraryException ex) { response.Message = ex.Message; } catch (Exception) { response.Message = "Internal server error"; } return(response); }