// POST api/receipt
        public HttpResponseMessage Post(Models.ReceiptModel receiptModel)
        {
            try
            {
                //Entities.Receipt receipt = receiptModel;

                //new Managers.ReceiptManager().Insert(Context.GetContext(), receipt);

                return(Request.CreateResponse(HttpStatusCode.OK, "Receipt Added Successfully"));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
コード例 #2
0
        // GET api/receipt
        public HttpResponseMessage Get()
        {
            try
            {
                var lst = new Managers.MyProductServiceManager().Get(Context.GetContext());

                List <Models.ReceiptModel> receiptList = new List <Models.ReceiptModel>();

                foreach (var service in lst)
                {
                    var model = new Models.ReceiptModel();
                    model = service;

                    receiptList.Add(model);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, new ResposeObject(receiptList)));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }