public Course CreateCourse(UpdateCourseVM course) => Map(course, x => new Course { Code = x.Code, Name = x.Name, CourseDepartmentCode = x.Department, });
public IHttpActionResult Update(UpdateCourseVM course) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { if (_courseService.Find(e => e.Code == course.Code) == null) { return(NotFound()); } if (_courseService.Update(ModelBuilder.CreateCourse(course))) { return(Ok()); } return(BadRequest()); } catch (Exception ex) { _loggingService.Write(ex); return(InternalServerError(ex)); } }