示例#1
0
        public async Task <HttpResponseMessage> CreateOrUpdate()
        {
            var requestContent = await Request.Content.ReadAsStringAsync();

            Invoice invoice = JsonConvert.DeserializeObject <Invoice>(requestContent);

            return(Request.CreateResponse(HttpStatusCode.OK, _invoiceManagement.CreateOrUpdate(invoice)));
        }
示例#2
0
        public async Task <HttpResponseMessage> CreateOrUpdate([FromBody] Invoice invoice)
        {
            var requestContent = await Request.Content.ReadAsStringAsync();

            invoice = JsonConvert.DeserializeObject <Invoice>(requestContent);
            bool success = _invoiceManagement.CreateOrUpdate(invoice);

            if (success)
            {
                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }