示例#1
0
        private async Task SetOrderReceivedDocumentation(InvoiceInInputModel input)
        {
            foreach (var orderTo in input.OrderTos)
            {
                var receivedDoc = this.mapper.Map <Documentation>(orderTo.DocumentationRecievedDocumentation);
                this.documentations.All().FirstOrDefault(d => d.OrderToId == orderTo.Id).RecievedDocumentation = receivedDoc;
            }

            await this.documentations.SaveChangesAsync();
        }
示例#2
0
        public async Task <IActionResult> Finish(InvoiceInInputModel input)
        {
            var invoiceId = await this.ordersService.FinishInvoiceInAsync(input);

            if (!this.ordersService.ValidateFinishModel(input.OrderTos))
            {
                await this.invoicesService.MarkInvoiceInForApproval(invoiceId);

                this.notyfService.Warning(this.localizer["Invoice marked for approval."]);
            }
            else
            {
                await this.invoicesService.UpdateInvoiceInStatusAsync(invoiceId, InvoiceStatusNames.AwaitingPayment.ToString());

                this.notyfService.Success(this.localizer["Order finished."]);
            }

            return(this.RedirectToAction("Check"));
        }
示例#3
0
        public async Task <string> FinishInvoiceInAsync(InvoiceInInputModel input)
        {
            await this.SetOrderReceivedDocumentation(input);

            var invoiceIn = new InvoiceIn();

            invoiceIn = this.mapper.Map <InvoiceInModel, InvoiceIn>(input.InvoiceIn, invoiceIn);
            foreach (var orderToInput in input.OrderTos)
            {
                var orderTo = this.orderTos.All().FirstOrDefault(o => o.Id == orderToInput.Id);
                orderTo.InvoiceIn = invoiceIn;
            }

            await this.invoiceIns.AddAsync(invoiceIn);

            await this.invoiceIns.SaveChangesAsync();

            return(invoiceIn.Id);
        }
示例#4
0
 public Task ApproveInvoice(InvoiceInInputModel input)
 {
     throw new NotImplementedException();
 }