public object AddEvent([FromBody] CalendarEventModel calendarEventModel) { try { try { Calendar calendar = _calendarRepository.AddEvent(calendarEventModel.DoctorId, calendarEventModel.PatientId, calendarEventModel.StartTime, calendarEventModel.EndTime, calendarEventModel.Title, calendarEventModel.Notes, calendarEventModel.Duration, calendarEventModel.Status, 1, true, false, DateTimeOffset.Now); calendarEventModel.CalendarId = calendar.CalendarId; return(new SingleResponse <CalendarEventModel> { Message = string.Empty, DidError = false, ErrorMessage = string.Empty, Token = string.Empty, Model = calendarEventModel }); } catch (Exception ex) { return(new SingleResponse <CalendarEventModel> { Message = string.Empty, DidError = true, ErrorMessage = ex.Message, Token = string.Empty, Model = null }); } } catch (Exception ex) { return(new SingleResponse <CalendarEventModel> { Message = string.Empty, DidError = true, ErrorMessage = ex.Message, Token = string.Empty, Model = null }); } }
public async Task <bool> Handle(CreateCalendarEventCommand request, CancellationToken cancellationToken) { var model = new Models.CalendarEvent() { Description = request.Description }; var addedEvent = await _calendarRepository.AddEvent(model); var @event = new CalendarEventAddedEvent() { Description = addedEvent.Description, Id = addedEvent.Id }; _bus.Publish(@event); return(true); }
public void AddEvent(EventScheduled @event, string userName) { _repository.AddEvent(@event, userName); }