public LoginStructure GetAccount(String user, String password) { using (var context = new LoLEsportsDbContext()) { using (var dbContextTransaction = context.Database.BeginTransaction()) { try { LoginStructure login = new LoginStructure(); Account acc = context.Account.Where(i => i.UserName.Equals(user) && i.Password.Equals(password)).FirstOrDefault(); if (acc == null) { login.error = 1; login.message = "Invalid username/password combination."; return(login); } login.error = 0; login.UserID = acc.UserId; login.ChampionImage = context.Champion.Where(i => i.ChampionId == acc.ChampionId).Select(x => x.ChampionImage).FirstOrDefault(); return(login); } catch (Exception) { dbContextTransaction.Rollback(); LoginStructure data = new LoginStructure(); data.error = 1; data.message = "Database could not commit transaction."; return(data); } } } }
public WindowViewModel(Window window) { _mainWindow = (MainWindow)window; Login = new LoginStructure(_mainWindow); Login.UpdateMainWindow += Update; GetServersListFromApi = new RelayCommand(async() => await GetServersListFromApiImpl()); GetServersListFromDB = new RelayCommand(GetServersListFromDBImpl); }
private ResponseModel AuthenticateUserLogin(string sLoginID, string sPassword) { string sFunctionName = "AuthenticateUserLogin(,)"; ResponseModel Result = new ResponseModel(); LoginStructure Login = new LoginStructure(); Result = Login.AuthenticateUserLogin(sLoginID, sPassword); return(Result); }
public ResponseModel LoadChildMenuItemsList(List <UserModel.UserPermission> UserPermissions) { string sFunctionName = "LoadChildMenuItemsList"; ResponseModel Result = new ResponseModel(); LoginStructure Login = new LoginStructure(); try { Result = Login.LoadChildMenuItemsList(UserPermissions); } catch (Exception ex) { Result.FailedWithException(); } return(Result); }
public ResponseModel GetUserPermissions(UserModel userModel) { string sFunctionName = "GetUserPermissions"; ResponseModel Result = new ResponseModel(); LoginStructure Login = new LoginStructure(); try { Result = Login.GetUserPermissions(userModel); } catch (Exception ex) { Result.FailedWithException(); } return(Result); }
public ResponseModel ValidateUserLogin(string UserID, string Password) { string sFunctionName = "ValidateUserLogin"; ResponseModel Result = new ResponseModel(); LoginStructure Login = new LoginStructure(); try { Result = Login.AuthenticateUserLogin(UserID, Password); } catch (Exception ex) { Result.FailedWithException(); } return(Result); }
public ActionResult Login(LoginStructure loginStructure) { AuthenticationContext authenticationContext = new AuthenticationContext(); Authentication authentication = authenticationContext.Authentications.SingleOrDefault(entity => entity.Email == loginStructure.Email); if (authentication != null) { if (authentication.Password == loginStructure.Password) { return(RedirectToAction("ListBook", "BookShop", new { id = authentication.id })); } else { return(Content("Please check the password")); } } else { return(Content("Account does not exists. Please call again later")); } }