//Added | Ranjeet | 19-dec | Get User Available Balance public DL_UserBalanceReturn GetUserBalace(User user) { this.SpName = DL_StoreProcedure.SP_DHS_API_GetUserBalance; //Sp Name this._IsSuccess = false; try { SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@UserId", user.UserId); ds = db.GetDataSet(this.SpName, param); if (ds != null && ds.Tables.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; this.dL_UserBalanceReturn = new DL_UserBalanceReturn() { AvailBal = dr["AvailBal"].ToString(), Status = Convert.ToInt32(dr["Status"]) }; this._IsSuccess = true; } } catch (Exception ex) { Logger.WriteLog(LogLevelL4N.ERROR, "Exeception : " + ex.Message); this._IsSuccess = false; } return(this.dL_UserBalanceReturn); }
public HttpResponseMessage GetUserBalance(HttpRequestMessage req, int userId) { if (userId > 0) { User user = new User() { UserId = userId.ToString() }; BL_Login userBal = new BL_Login(); DL_UserBalanceReturn userBalanceReturn = userBal.GetUserBalace(user); if (userBal._IsSuccess) { return(req.CreateResponse <DL_UserBalanceReturn>(HttpStatusCode.OK, userBalanceReturn)); } return(req.CreateErrorResponse(HttpStatusCode.Unauthorized, "Unauthorized")); } return(req.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request")); } //