Пример #1
0
        public IActionResult GetInvoiceDetails(int invoiceId)
        {
            var invoice = _invoiceManager.GetInvoice(invoiceId);

            var response = InvoiceDetails.MapFromObject(invoice);

            return(Ok(response));
        }
Пример #2
0
        public IActionResult AddTicketsToInvoice([FromBody] InvoiceTicketForm form)
        {
            var invoice = _invoiceManager.AddTicketsToInvoice(form.MapToCore());

            if (invoice == null)
            {
                return(BadRequest("There Was An Error"));
            }
            else
            {
                var response = InvoiceDetails.MapFromObject(invoice);
                return(Ok(response));
            }
        }
Пример #3
0
        public IActionResult EditInvoice([FromBody] InvoiceForm form)
        {
            Error error = new Error();

            _invoiceManager.RemoveCityExpensesFromInvoice(form.CityExpensesToRemove);
            _invoiceManager.RemoveInvoiceAccounts(form.InvoiceAccountsToRemove);

            var invoice = _invoiceManager.EditInvoice(form.MapToCore(), ref error);

            if (error.ErrorCode != ErrorCode.OKAY)
            {
                return(BadRequest(error.Message));
            }

            var response = InvoiceDetails.MapFromObject(invoice);

            return(Ok(response));
        }