public int Login(string userName, string password) { var result = new SqlParameter { ParameterName = "result", DbType = System.Data.DbType.Int32, Direction = System.Data.ParameterDirection.Output }; password = HashAndSalt.GenerateHash(password); _db.Database.ExecuteSqlCommand($"exec Login @p0,@p1,@result out", userName, password, result); return((int)result.Value); }
public int Register(User user) { var result = new SqlParameter { ParameterName = "result", DbType = System.Data.DbType.Int32, Direction = System.Data.ParameterDirection.Output }; string password = HashAndSalt.GenerateHash(user.Password); _db.Database.ExecuteSqlCommand($"exec Register @p0,@p1,@p2,@result out", user.Username, password, user.Phone, result); return((int)result.Value); }