예제 #1
0
        public int QuoteInsert(QuoteInsertRequest model)
        {
            int id = 0;

            try
            {
                DataProvider.ExecuteNonQuery(GetConnection, "dbo.Quote_Insert"
                                             , inputParamMapper : delegate(SqlParameterCollection paramCollection)
                {
                    paramCollection.AddWithValue("@bidId", model.BidId);
                    paramCollection.AddWithValue("@buyerCompanyId", model.BuyerCompanyId);
                    paramCollection.AddWithValue("@sellerCompanyId", model.SellerCompanyId);
                    paramCollection.AddWithValue("@quoteRequestId", model.QuoteRequestId);
                    paramCollection.AddWithValue("@quoteRequestItemUniqueId", model.QuoteRequestItemUniqueId);

                    SqlParameter p = new SqlParameter("@id", System.Data.SqlDbType.Int);
                    p.Direction    = System.Data.ParameterDirection.Output;

                    paramCollection.Add(p);
                }, returnParameters : delegate(SqlParameterCollection param)
                {
                    int.TryParse(param["@id"].Value.ToString(), out id);
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(id);
        }
예제 #2
0
        public HttpResponseMessage QuoteInsert(QuoteInsertRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            ItemResponse <int> response = new ItemResponse <int>();

            response.Item = _QuoteService.QuoteInsert(model);

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }