public bool UpdateSessionAssets(Session session, bool isVideo) { if (session.Id <= 0) { return(false); } DAL.EntityFramework.Session coreSession = UnitOfWork.SessionRepository .GetSessionWithAttendeesTrackable(session.Id); if (!isVideo) { coreSession.SlideName = session.SlideName; } else { coreSession.VideoFileName = session.VideoFileName; } return(UnitOfWork.Commit() > 0); }
/// <summary> /// method to Add or edit session details /// </summary> /// <param name="objSession">instance of session Object</param> /// <returns>boolean resutt of event's success</returns> public bool UpdateSessionsDetails(Session objSession, User currentUser) { if (objSession.Id <= 0) { return(false); } try { DAL.EntityFramework.Session coreSession = UnitOfWork.SessionRepository .GetSessionWithAttendeesTrackable(objSession.Id); coreSession.SessionDate = objSession.Date; coreSession.Description = objSession.Description; coreSession.Title = objSession.Title; coreSession.SlideName = objSession.SlideName; coreSession.VideoFileName = objSession.VideoFileName; coreSession.UserSessionMappings.Where(x => objSession.SessionAttendees.All(y => y.UserId != x.UserId)) .ToList() .ForEach(trainee => coreSession.UserSessionMappings.Remove(trainee)); objSession.SessionAttendees.Where(x => coreSession.UserSessionMappings.All(y => y.UserId != x.UserId)) .ToList() .ForEach(trainee => coreSession.UserSessionMappings.Add(new UserSessionMapping { AddedBy = currentUser.UserId, AddedOn = DateTime.Now, UserId = trainee.UserId })); objSession.Presenter = currentUser; return(UnitOfWork.Commit() > 0 && (new NotificationBl().AddSessionNotification(objSession))); } catch (Exception ex) { LogUtility.ErrorRoutine(ex); return(false); } }
/// <summary> /// method to Add or edit session details /// </summary> /// <param name="objSession">instance of session Object</param> /// <param name="currentUser">instance of Current User</param> /// <returns>boolean resutt of event's success</returns> public SessionVm AddNewSession(Session objSession, User currentUser) { objSession.IsNeW = (objSession.Id == 0); objSession.Presenter = currentUser; DAL.EntityFramework.Session coreSession = SessionConverter.ConvertToCore(objSession); foreach (var trainee in objSession.SessionAttendees) { coreSession.UserSessionMappings.Add(new UserSessionMapping { AddedBy = currentUser.UserId, AddedOn = DateTime.Now, UserId = trainee.UserId }); } UnitOfWork.SessionRepository.Add(coreSession); UnitOfWork.Commit(); objSession.Id = coreSession.SessionId; new NotificationBl().AddSessionNotification(objSession); return(GetSessionOnFilter(1, (int)Common.Enumeration.SessionType.All, coreSession.SessionId, "", currentUser)); }