public object Get(int userid) { Usuario user = MyGymContext.DB.Usuario.Find(userid); if (user == null) { return(APIFunctions.ErrorResult(string.Format(JsonMessage.NotFound, "Usuario"))); } return(APIFunctions.SuccessResult(APIFunctions.UsuarioToUser(user), JsonMessage.Success)); }
public object LogIn(string user, string password) { var result = MyGymContext.DB.Usuario.FirstOrDefault(item => (item.Email == user | item.Nick == user) & item.Password == password); if (result == null) { return(APIFunctions.ErrorResult(JsonMessage.ErrorLogin)); } return(APIFunctions.SuccessResult(APIFunctions.UsuarioToUser(result), JsonMessage.Success)); }