コード例 #1
0
        public async Task RemoveSchedule(string scheduleId)
        {
            var request = new RemoveScheduleRequestDto
            {
                ScheduleId = scheduleId
            };

            await _scheduleService.RemoveScheduleAsync(request);

            HttpContext.Response.StatusCode = (int)HttpStatusCode.OK;
        }
コード例 #2
0
        public async Task RemoveScheduleAsync(RemoveScheduleRequestDto request)
        {
            var existingSchedule = await _dataService.GetSet <AdmissionHours>()
                                   .FirstOrDefaultAsync(x => x.Id.ToString() == request.ScheduleId && x.IsCurrent);

            if (existingSchedule == null)
            {
                throw new InvalidScheduleIdException($"Couldn't find active schedule with id: {request.ScheduleId}");
            }

            existingSchedule.IsCurrent = false;
            await _dataService.SaveDbAsync();
        }