private CalendarEventDTO Create(CalendarEventViewModel viewModel) { try { log.Debug(CalendarEventViewModel.FormatCalendarEventViewModel(viewModel)); CalendarEventDTO calendarEvent = new CalendarEventDTO(); // copy values viewModel.UpdateDTO(calendarEvent, null); //RequestContext.Principal.Identity.GetUserId()); // audit calendarEvent.CreateBy = null; //RequestContext.Principal.Identity.GetUserId(); calendarEvent.CreateOn = DateTime.UtcNow; // add log.Debug("_calendarEventService.AddCalendarEvent - " + CalendarEventDTO.FormatCalendarEventDTO(calendarEvent)); int id = _calendarEventService.AddCalendarEvent(calendarEvent); calendarEvent.CalendarEventId = id; log.Debug("result: 'success', id: " + id); return(calendarEvent); } catch (Exception e) { // error log.Error(e.ToString()); throw; } }
public ActionResult <CalendarEventAddViewModel> AddCalendarEvent(CalendarEventAddViewModel calendarEvent) { CalendarEventAddViewModel calendarEventAdd = new CalendarEventAddViewModel(); try { calendarEventAdd = _calendarEventService.AddCalendarEvent(calendarEvent); } catch (Exception es) { calendarEventAdd._failure = true; calendarEventAdd._message = es.Message; } return(calendarEventAdd); }