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))); }
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)); } }