private async Task RemoveApplication(ReciveLogoutMessageEvent e) { using var scope = Services.CreateScope(); var _ordinationService = scope.ServiceProvider .GetRequiredService <IOrdinationService>(); var _applicationService = scope.ServiceProvider .GetRequiredService <IApplicationService>(); var application = await _applicationService .GetApplicationByPatientId(Guid.Parse(e.PatientId.ToString())); var ordination = await _ordinationService .GetOrdinationById(Guid.Parse(e.OrdinationId.ToString())); if (application != null) { await _applicationService .DeleteApplication(application); await _signalrHub.Clients.All .SendAsync("RemovedFromWaitingList", e.PatientId.ToString(), e.OrdinationId.ToString()); } var inside = await _applicationService .NumberInside(Guid.Parse(e.OrdinationId)); var outside = await _applicationService .NumberOutside(ordination.Id); if (ordination.MaxIn > inside && outside > 0) { var toBeUpdated = await _applicationService .GetAppoitmentFirstDate(); await _applicationService .UpdateApplication(toBeUpdated, Status2.In); inside++; } await _signalrHub.Clients.All .SendAsync("NumberOfPeople", inside, outside); }
public void Publish(ReciveLogoutMessageEvent eventMessage) { _subject.OnNext(eventMessage); }