public HttpResponseMessage GetCreditsByUserId(string UserId) { ItemResponse <UserCreditsBalance> response = new ItemResponse <UserCreditsBalance>(); // UserCreditsService UserCreditsService = new UserCreditsService(); UserCreditsBalance Balance = _CreditsService.GetBalance(UserId); response.Item = Balance; return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public UserCreditsBalance GetBalance(string UserId) { UserCreditsBalance Balance = null; DataProvider.ExecuteCmd(GetConnection, "dbo.UserCredits_SelectByUserId" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@UserId", UserId); }, map : delegate(IDataReader reader, short set) { Balance = new UserCreditsBalance(); int startingIndex = 0; Balance.UserId = reader.GetSafeString(startingIndex++); Balance.Amount = reader.GetSafeDecimal(startingIndex++); } ); return(Balance); }