public HttpResponseMessage Post(FundInfo fund) { try { FundBl.AddNewFund(fund); return new HttpResponseMessage(HttpStatusCode.OK); } catch (Exception) { return new HttpResponseMessage(HttpStatusCode.BadRequest); } }
private static SqlParameter[] GetAddFundParams(FundInfo fund) { SqlParameter[] sqlParms = new SqlParameter[100]; sqlParms = SQLHelper.GetCachedParameters(PROC_ADDNEWFUND); if (sqlParms == null) { sqlParms = new SqlParameter[] { new SqlParameter(PARAM_RETURN, SqlDbType.Int), new SqlParameter(PARAM_FUND_DESC, SqlDbType.NVarChar, 100), new SqlParameter(PARAM_FUND_AMOUNT, SqlDbType.Float), new SqlParameter(PARAM_CHANGEDBY, SqlDbType.NVarChar, 50) }; sqlParms[0].Direction = ParameterDirection.ReturnValue; SQLHelper.CacheParameters(PROC_ADDNEWFUND, sqlParms); } //Assigning values to parameter sqlParms[0].Value = -1; sqlParms[1].Value = fund.FundDesc; sqlParms[2].Value = fund.FundAmount; sqlParms[3].Value = "vysali"; return sqlParms; }
public static int UpdateFund(FundInfo fund, out int retValue) { retValue = -1; SqlParameter[] parms = GetUpdateFundParams(fund); return ExecuteNonQuery(PROC_UPDATEFUND, parms, out retValue); }
public static int AddNewFund(FundInfo fund, out int retValue) { retValue = -1; SqlParameter[] parms = GetAddFundParams(fund); return ExecuteNonQuery(PROC_ADDNEWFUND, parms, out retValue); }
public HttpResponseMessage Post(FundInfo fund) { return FundBl.UpdateFund(fund); }
public FundInfo Get(int id) { FundInfo fund = new FundInfo(); fund = FundBl.GetFundById(id); return fund; }