public ActionResult Edit(CourseEditModel modelCourse) { var course = _courseRepository.GetById(modelCourse.Id); var courseModel = Mapper.Map<CourseEditModel, Course>(modelCourse); _courseRepository.UpdateCourseFromCourseEditModel(courseModel, course); const string title = "Materia Actualizada"; var content = course.Name + " ha sido modificado exitosamente."; _viewMessageLogic.SetNewMessage(title, content, ViewMessageType.SuccessMessage); return RedirectToAction("Index"); }
public ActionResult Edit(int id) { var course = _courseRepository.GetCourseEditModelById(id); var editCourse = new CourseEditModel { Id = course.Id, Name = course.Name, Area = course.Area }; ViewBag.AreaId = new SelectList(_areaRepository.Query(a => a), "Id", "Name", editCourse.Area); return View("Edit", editCourse); }