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))); }
public IActionResult NewCalendar([FromBody] CalendarInputModel model) { return(Ok(_calendarAppService.NewCalendar(model))); }