Exemplo n.º 1
0
        public IHttpActionResult EditInvoice(Invoice Invoice)
        {
            if (Invoice == null)
            {
                return(BadRequest("Invoice object cannot be found in the request body."));
            }
            try
            {
                var dbInvoice = invoicesService.GetInvoice(Invoice.InvoiceId);
                Invoice.CreatedDate = dbInvoice.CreatedDate;
                invoicesService.UpdateInvoice(Invoice);

                var Invoices    = invoicesService.GetInvoices();
                var partialView = Helpers.RenderPartial("~/Views/Shared/Partial/Invoices/InvoicesList.cshtml", Invoices);
                return(Ok(partialView));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }