public void Add(User user) { using (FondMcfoContext db = new FondMcfoContext()) { db.Users.Add(user); db.SaveChanges(); } }
public void Edit(User user) { using (FondMcfoContext db = new FondMcfoContext()) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); } }
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; } }