Ejemplo n.º 1
0
        public HttpResponseMessage AddedToCart(HttpRequestMessage req, RP_AddedToCart rpAddedToCart)
        {
            if (rpAddedToCart != null)
            {
                RM_AddedToCart rmAddedToCart = new RM_AddedToCart();
                List<RPR_AddedToCart> rprAddedToCart = rmAddedToCart.AddedToCart(rpAddedToCart);

                if (rmAddedToCart._IsSuccess)
                    return req.CreateResponse<List<RPR_AddedToCart>>(HttpStatusCode.Created, rprAddedToCart);

                return req.CreateErrorResponse(HttpStatusCode.InternalServerError, "ServerError");
            }

            return req.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request");
        }
Ejemplo n.º 2
0
 public List<RPR_AddedToCart> AddedToCart(RP_AddedToCart rpAddedToCart)
 {
     this.SpName = "DigitalMenu_AddToCart"; //Sp Name
     _IsSuccess = true;
     try
     {
         SqlParameter[] param = new SqlParameter[6];
         param[0] = new SqlParameter("@WaitorId", rpAddedToCart.WaitorId.Trim());
         param[1] = new SqlParameter("@key", rpAddedToCart.key);
         param[2] = new SqlParameter("@RestId", int.Parse(rpAddedToCart.RestId));
         param[3] = new SqlParameter("@CusId", int.Parse(rpAddedToCart.CusId));
         param[4] = new SqlParameter("@ItemId", rpAddedToCart.ItemId);
         param[5] = new SqlParameter("@TableId", rpAddedToCart.TableId);
         ds = db.GetDataSet(this.SpName, param);
         if (ds != null && ds.Tables.Count > 0)
         {
             rprAddedToCart = SerializeData.SerializeMultiValue<RPR_AddedToCart>(ds.Tables[0]);
         }
     }
     catch (Exception ex)
     {
         _IsSuccess = false;
         Logger.WriteLog(LogLevelL4N.ERROR, " Add to Cart | Exception : " + ex.Message);
     }
     return rprAddedToCart;
 }