Example #1
0
 public IHttpActionResult Create([FromBody] CreateCalendarDateDto calendarDate)
 {
     if (calendarDate == null)
     {
         return(BadRequest());
     }
     if (!ModelState.IsValid)
     {
         string errorMessage = new ModelStateError(_logger).OutputMessage(ModelState);
         return(BadRequest(errorMessage));
     }
     try
     {
         _calendarDateService.Create(calendarDate);
     }
     catch (LogicalException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch
     {
         return(BadRequest(AppSettings.INTERNAL_SERVER_ERROR_MESSAGE));
     }
     return(Ok());
 }
        public void Create(CreateCalendarDateDto dto)
        {
            var calendarDate = new CalendarDate
            {
                Title     = dto.Title,
                Date      = dto.Date.Date,
                IsHoliday = dto.IsHoliday
            };

            _calendarDateRepository.Insert(calendarDate);
        }