コード例 #1
0
 public void Add(UserSession userSession)
 {
     using (FondMcfoContext db = new FondMcfoContext())
     {
         db.UserSessions.Add(userSession);
         db.SaveChanges();
     }
 }}
コード例 #2
0
ファイル: UserActions.cs プロジェクト: kosenv/NMActiveMSFO
 public void AddSession(string domainName, UserSession sessions)
 {
     using (FondMcfoContext db = new FondMcfoContext())
     {
         User user = db.Users.FirstOrDefault(u => u.DomainName == domainName);
         if (user != null)
         {
             user.UserSessionses.Add(sessions);
             db.SaveChanges();
         }
     }
 }
コード例 #3
0
ファイル: UserManager.cs プロジェクト: kosenv/NMActiveMSFO
 public User ManageStartSessions()
 {
     var actionsUser = new UserActions();
     if (actionsUser.Find(_domainName) != null)
     {
         var session = new UserSession{ DateStart = DateTime.Now, IdSessionAplication = _idSessionsApplication };
         actionsUser.AddSession(_domainName, session);
         return actionsUser.Find(_domainName);
     }
     else
     {
         var seacher = new UserSeacher(_domainName);
         var userNew = new User {DomainName = _domainName,RegistrationDate = DateTime.Now,Fio = seacher.GetFIOUser() };
         var sessionsNew = new UserSession { DateStart = DateTime.Now, Users = userNew};
        
         var actionsUserSession = new UserSessionAction();
         actionsUserSession.Add(sessionsNew);
 
         return userNew;
     }
 }