public int ValidateCredentials(UserModel user) { try { var db_conection = new DBManagement(); bool access_granted = false; if (db_conection.ExistUser(user.UserName)) { access_granted = db_conection.ValidateCredentials(user.UserName, user.Password); if (access_granted) { return(1); } else { return(0); } } return(2); } catch (Exception) { return(0); } }
public int CreateUser(UserModel user) { try { var db_conection = new DBManagement(); if (!db_conection.ExistUser(user.UserName)) { if (db_conection.InsertUser(user)) { return(1); } } return(0); } catch (Exception) { return(0); } }