public async Task <UpdateSessionEventResponse> UpdateSessionEvent(UpdateSessionEventRequest request) { var session = await _sessionService.GetAuthenticatedSession(); var response = new UpdateSessionEventResponse(); using (var uow = _uowFactory.GetUnitOfWork()) { await uow.SessionRepo.UpdateSessionEvent(new Infrastructure.Repositories.SessionRepo.Models.UpdateSessionEventRequest() { Id = request.Id, Description = request.Description, Updated_By = session.User.Entity.Id }); uow.Commit(); } _cache.Remove(CacheConstants.SessionEvents); var sessionEvents = await _cache.SessionEvents(); var sessionEvent = sessionEvents.FirstOrDefault(c => c.Id == request.Id); await _sessionService.WriteSessionLogEvent(new Models.ServiceModels.Session.CreateSessionLogEventRequest() { EventKey = SessionEventKeys.SessionEventUpdated }); response.Notifications.Add($"Session event '{sessionEvent.Key}' has been updated", NotificationTypeEnum.Success); return(response); }
public async Task <UpdateSessionEventResponse> UpdateSessionEvent(UpdateSessionEventRequest request) { var sessionUser = await _sessionManager.GetUser(); var response = new UpdateSessionEventResponse(); using (var uow = _uowFactory.GetUnitOfWork()) { await uow.SessionRepo.UpdateSessionEvent(new Repositories.DatabaseRepos.SessionRepo.Models.UpdateSessionEventRequest() { Id = request.Id, Description = request.Description, Updated_By = sessionUser.Id }); uow.Commit(); } _cache.Remove(CacheConstants.SessionEvents); var sessionEvents = await _cache.SessionEvents(); var sessionEvent = sessionEvents.FirstOrDefault(c => c.Id == request.Id); await _sessionManager.WriteSessionLogEvent(new Models.ManagerModels.Session.CreateSessionLogEventRequest() { EventKey = SessionEventKeys.SessionEventUpdated, Info = new Dictionary <string, string>() { { "Key", sessionEvent.Key.ToString() } } }); response.Notifications.Add($"Session event '{sessionEvent.Key}' has been updated", NotificationTypeEnum.Success); return(response); }