コード例 #1
0
 public bool Delete(int id)
 {
     if (string.IsNullOrWhiteSpace(id.ToString()))
     {
         return(false);
     }
     else
     {
         return(iCalendarRepository.Delete(id));
     }
 }
コード例 #2
0
 public async Task <IActionResult> DeleteCalender(string id)
 {
     try
     {
         return(Ok(await _repository.Delete(id)));
     }
     catch (Exception exc)
     {
         _logger.LogError($"Error: {exc}");
         // transaction.Rollback();
         return(NotFound());
     }
 }
コード例 #3
0
        public async Task <ResponseDto <BaseModelDto> > DeleteCalendar(string calendarId)
        {
            var response = new ResponseDto <BaseModelDto>();
            var service  = await _googleCalendarService.GetCalendarService();

            if (service == null)
            {
                response.Errors.Add(ServiceErrors.SERVICE_ERROR);
                return(response);
            }

            var calendars = await GetListOfCalendars();

            if (calendars.ErrorOccurred)
            {
                response.Errors.Add(ServiceErrors.STH_WENT_WRONG_ERROR);
                return(response);
            }

            var exist = calendars.Object.CalendarList.Exists(cal => cal.Id == calendarId);

            if (!exist)
            {
                response.Errors.Add(ServiceErrors.CALENDAR_DOES_NOT_EXIST_ERROR);
                return(response);
            }

            var dbCalendar = await _calendarRepository.GetById(calendarId);

            if (dbCalendar == null)
            {
                response.Errors.Add(ServiceErrors.CALENDAR_DOES_NOT_EXIST_ERROR);
                return(response);
            }

            await service.Calendars.Delete(calendarId).ExecuteAsync();

            await _calendarRepository.Delete(dbCalendar);

            return(response);
        }
コード例 #4
0
 public async Task DeleteEvent(Guid id, string userId)
 {
     await _repository.Delete(id, userId);
 }