Ejemplo n.º 1
0
        public ActionResult InvoiceDetails(int id)
        {
            ViewData["InvoicesManagement"] = "active";
            var service   = invoicesService.GetInvoice(id);
            var viewModel = new InvoiceDetailsViewModel()
            {
                Invoice          = invoicesService.GetInvoice(id),
                InvoiceJobs      = jobsService.GetPOJobs(service.POId).Select(j => j.AutoMapObject <Job, JobDetailsViewModel>()).ToList(),
                InvoiceWorkflows = invoicesService.GetInvoiceWorkflows(id).ToList()
            };

            return(View(viewModel));
        }
Ejemplo n.º 2
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));
            }
        }