public static bool InitializeUserLogin(fm_Users User) { try { using (var model = new fmDbDataModel()) { UserSingleton.CreateUserSingleton(User); HttpContext.Current.Session["USER_ID"] = User.Id; HttpContext.Current.Session["USER_EMAIL"] = UserSingleton.Instance.Email; User.LastSuccessfullLogin = DateTime.Now; User.IsOnline = (int)UserCurrentStatus.Online; model.Entry <fm_Users>(User).State = System.Data.Entity.EntityState.Modified; model.SaveChanges(); } return(true); } catch (Exception e) { _log.ErrorFormat("There was an error with initializing user login. Message: {0}, Stacktrace: {1}", e.Message, e.StackTrace); return(false); } }