public async Task Set([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.Add(nameOfOrganisation, theDay); var savedItems = await GetInOfficeAvailability(nameOfOrganisation); _attendance.Labels(nameOfOrganisation).Set(savedItems.Count()); }
public async Task <Availability> AddAvailability(AddAvailabilityCommand addAvailabilityCommand) { Availability availability = new Availability( addAvailabilityCommand.SiteId, addAvailabilityCommand.StaffId, addAvailabilityCommand.ServiceItemId, addAvailabilityCommand.LocationId, addAvailabilityCommand.StartDateTime, addAvailabilityCommand.EndDateTime, addAvailabilityCommand.Sunday, addAvailabilityCommand.Monday, addAvailabilityCommand.Tuesday, addAvailabilityCommand.Wednesday, addAvailabilityCommand.Thursday, addAvailabilityCommand.Friday, addAvailabilityCommand.Saturday, addAvailabilityCommand.BookableEndDateTime); _availabilityRepository.Add(availability); await _businessIntegrationEventService.PublishThroughEventBusAsync(new AvailabilityAddedByStaffEvent( availability.StaffId, availability.SiteId, availability.StaffId, availability.ServiceItemId, availability.LocationId, availability.StartDateTime, availability.EndDateTime, availability.Sunday, availability.Monday, availability.Tuesday, availability.Wednesday, availability.Thursday, availability.Friday, availability.Saturday, availability.BookableEndDateTime )); //_availabilityRepository.UnitOfWork.Commit(); return(availability); }
public Task Handle(AvailabilityCreatedEvent message) { Availability availability = new Availability( message.Id, message.SiteId, message.StaffId, message.ServiceItemId, message.LocationId, message.StartDateTime, message.EndDateTime, message.Sunday, message.Monday, message.Tuesday, message.Wednesday, message.Thursday, message.Friday, message.Saturday, message.BookableEndDateTime); _availabilityRepository.Add(availability); _availabilityRepository.SaveChanges(); return(Task.CompletedTask); }