public HttpResponseMessage ViewCart(HttpRequestMessage req, RP_ViewCart rpViewCart) { if (rpViewCart != null) { RM_ViewCart rmViewCart = new RM_ViewCart(); List<RPR_ViewCart> rprViewCart = rmViewCart.ViewCart(rpViewCart); if (rmViewCart._IsSuccess) return req.CreateResponse<List<RPR_ViewCart>>(HttpStatusCode.Created, rprViewCart); return req.CreateErrorResponse(HttpStatusCode.InternalServerError, "ServerError"); } return req.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request"); }
public List<RPR_ViewCart> ViewCart(RP_ViewCart rpViewCart) { this.SpName = "DigitalMenu_ViewCart"; //Sp Name _IsSuccess = true; try { SqlParameter[] param = new SqlParameter[5]; param[0] = new SqlParameter("@WaitorId", rpViewCart.WaitorId.Trim()); param[1] = new SqlParameter("@key", rpViewCart.key); param[2] = new SqlParameter("@RestId", int.Parse(rpViewCart.RestId)); param[3] = new SqlParameter("@CusId", int.Parse(rpViewCart.CusId)); param[4] = new SqlParameter("@TableId", rpViewCart.TableId); ds = db.GetDataSet(this.SpName, param); if (ds != null && ds.Tables.Count > 0) { rprViewCart = SerializeData.SerializeMultiValue<RPR_ViewCart>(ds.Tables[0]); } } catch (Exception ex) { _IsSuccess = false; Logger.WriteLog(LogLevelL4N.ERROR, " View Cart | Exception : " + ex.Message); } return rprViewCart; }