Exemplo n.º 1
0
        public ResponseViewModel NewCalendar(CalendarInputModel calendar)
        {
            var events = _calendarService.CalendarEvents().FirstOrDefault(x => x.Id == calendar.EventTypeId);

            if (events == null)
            {
                return(NotFound(ResponseMessageViewModel.INVALID_CALENDAR_EVENT, ResponseErrorCodeStatus.INVALID_CALENDAR_EVENT));
            }

            var plot = _plotService.AllPlots().FirstOrDefault(x => x.Id == calendar.PlotId);

            if (plot == null)
            {
                return(NotFound(ResponseMessageViewModel.INVALID_PLOT, ResponseErrorCodeStatus.INVALID_PLOT));
            }

            var mappedResult = _mapper.Map <CalendarInputModel, Calendar>(calendar);

            var result = _calendarService.NewCalendar(mappedResult);

            return(Ok(_mapper.Map <Calendar, CalendarViewModel>(result)));
        }
Exemplo n.º 2
0
 public IActionResult NewCalendar([FromBody] CalendarInputModel model)
 {
     return(Ok(_calendarAppService.NewCalendar(model)));
 }