public bool AddToDoItem(DateTime dateTime, string description) { var timeAvailable = _calendarService.DateTimeIsAvailable(dateTime); if (!timeAvailable) { return(false); } _toDoItemService.Save(new ToDoItem() { EventDateTime = dateTime, Description = description }); return(true); }
public async Task AddToDoItemAsync(DateTime dateTime, string description, string user) { var timeAvailable = _calendarService.DateTimeIsAvailable(dateTime); if (!timeAvailable) { await _toDoHubService.ReturnResultToUIAsync(user, false, "Time is not available").ConfigureAwait(false); return; } try { _toDoItemService.Save(new ToDoItem(dateTime, description)); } catch (Exception e) { await _toDoHubService.ReturnResultToUIAsync(user, false, e.Message).ConfigureAwait(false); return; } await GetToDoItemsAsync(user); }