public void UpdateUser(Users user)
        {
            foreach (UserRole r in userContext.UserRoles.Where(u => u.UserID == user.UserID).ToList())
              userContext.UserRoles.Remove(r);

            foreach (UserRole userRole in user.UserRoles)
                userContext.UserRoles.Add(userRole);
            userContext.Entry(user).State = EntityState.Modified;
            userContext.SaveChanges();
        }
 public void CreateModificationDetails(Users user)
 {
     user.ModificationType = "Created";
     ModificationDetails(user);
 }
 public void CreateNewUser(Users user)
 {
     userContext.UserProfiles.Add(user);
     userContext.SaveChanges();
 }
 public void ModificationDetails(Users user)
 {
     user.ModifiedDate = DateTime.Now;
     user.ModifiedBy = Convert.ToString(Session["UserID"]);
 }