コード例 #1
0
        public async Task Remove([FromBody] OfficeAvailableMutation mutation)
        {
            var nameOfOrganisation = "test";
            var nameOfPerson       = User.Claims.First(x => x.Type == "http://officeattendan.ce/name").Value;
            var theDay             = await GetInOfficeAvailableOrCreate(mutation.DateAsString, nameOfOrganisation, nameOfPerson);

            await _availabilityRepository.Remove("test", theDay);

            var savedItems = await GetInOfficeAvailability(nameOfOrganisation);

            _attendance.Set(savedItems.Count());
            _attendance.Labels(nameOfOrganisation).Set(savedItems.Count());
        }
コード例 #2
0
        public async Task <AvailabilityResponse> DeleteAsync(int id)
        {
            var existingavailability = await _availabilityRepository.FindByIdAsync(id);

            if (existingavailability == null)
            {
                return(new AvailabilityResponse(" availability not found."));
            }

            try
            {
                _availabilityRepository.Remove(existingavailability);
                await _unitOfWork.CompleteAsync();

                return(new AvailabilityResponse(existingavailability));
            }
            catch (Exception ex)
            {
                return(new AvailabilityResponse($"An error ocurred while deleting the Availability: {ex.Message}"));
            }
            throw new NotImplementedException();
        }