static void CopyLogs() { UserLoginContext context = new UserLoginContext(); Logs log = new Logs(); log.Activity = currentSessionActivities.Last(); context.Logs.Add(log); context.SaveChanges(); }
public static void AssignUserRole(string username, UserRoles newUserRole) { //foreach (User user in TestUsers) //{ // if (user.Username == username) // { // user.UserRole = newUserRole; // Logger.LogActivity("Change role of " + username); // } //} UserLoginContext context = new UserLoginContext(); User usr = (from u in UserData.TestUsers where u.Username == username select u).First(); usr.UserRole = newUserRole; context.SaveChanges(); }
public static void SetUserActiveTo(string username, DateTime newDateActive) { //foreach (User user in TestUsers) //{ // if (user.Username == username) // { // user.DateActive = newDateActive; // Logger.LogActivity("Change activity of " + username); // } //} UserLoginContext context = new UserLoginContext(); User usr = (from u in UserData.TestUsers where u.Username == username select u).First(); usr.DateActive = newDateActive; Logger.LogActivity("Change activity of " + username); context.SaveChanges(); }