Exemple #1
0
 public Semester CreateSemester(SemesterVM semester)
 => Map(semester, x =>
 {
     return(new Semester
     {
         Code = x.Code,
         StartDate = x.StartDate,
         EndDate = x.EndDate
     });
 });
 public IHttpActionResult Create(SemesterVM semester)
 {
     if (!ModelState.IsValid)
         return BadRequest(ModelState);
     try
     {
         if (_semesterService.Create(ModelBuilder.CreateSemester(semester)))
             return Ok();
         else
             return BadRequest();
     }
     catch (Exception ex)
     {
         _loggingService.Write(ex);
         return InternalServerError(ex);
     }
 }