Ejemplo n.º 1
0
        public IHttpActionResult PostInvoice(Invoice invoice)
        {
            if (invoice == null)
            {
                return(BadRequest("invoice object cannot be found in the request body."));
            }
            try
            {
                invoice.CreatedDate = DateTime.Now;
                invoicesService.CreateInvoice(invoice);
                invoicesService.UpdateInvoiceTaskActualStartDate(invoice.MilestoneId);

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