//Login public int ValidateLoginFromDB(UserLS userLS) { var UserSearchInDB = _ctx.UserLSs .Where(s => s.UserName == userLS.UserName) .First(); //Not found if (UserSearchInDB == null) { return(0); } //User password validation if (String.Compare(UserSearchInDB.Password, userLS.Password) == 0) { if (UserSearchInDB.IsAdmin) { return(5); //Admin } else { return(2); //General user } } //Password error return(1); }
public static UserLS CreateNewUserLSFromBody(UserLS userLSFromBody) { UserLS newUserLS = new UserLS(); newUserLS.StudentId = userLSFromBody.StudentId; return(newUserLS); }
public void AddUser(UserLS userLS) { _ctx.UserLSs.Add(userLS); Save(); }