Ejemplo n.º 1
0
 public Course CreateCourse(UpdateCourseVM course)
 => Map(course, x => new Course
 {
     Code = x.Code,
     Name = x.Name,
     CourseDepartmentCode = x.Department,
 });
Ejemplo n.º 2
0
        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));
            }
        }