public async Task <IActionResult> UpdateSalesInvoice([FromBody] SalesInvoiceDto salesInvoiceDto) { var salesInvoice = _mapper.Map <SalesInvoice>(salesInvoiceDto); await _salesInvoiceUseCase.UpdateSalesInvoice(salesInvoice); var response = new ApiResponse <SalesInvoice>(salesInvoice); return(Ok(response)); }
public async Task <SalesOrderOutput> GetSalesOrderForCreate() { //VARIABLES var output = new SalesOrderOutput(); var salesOrderDto = new SalesOrderDto(); var salesInvoiceDto = new SalesInvoiceDto(); var salesOrderLineDto = new SalesOrderLineDto(); var salesOrderLineDtoList = new List <SalesOrderLineDto>(); var salesInvoiceAdditionalCostDto = new SalesInvoiceAdditionalCostDto(); var salesInvoiceAdditionalCostDtoList = new List <SalesInvoiceAdditionalCostDto>(); var salesInvoicePaymentDto = new SalesInvoicePaymentDto(); var salesInvoicePaymentDtoList = new List <SalesInvoicePaymentDto>(); //DEFAULT SELECTED COMBOBOX var defaultSelectedCombobox = new ComboboxItemDto("0", "Please select ...") { IsSelected = true }; //CUSTOMER LOOKUP var customers = _lookup_customerRepository .GetAll() .Select(c => new ComboboxItemDto(c.Id.ToString(), c.Name + " (" + c.Company + ")")) .ToList(); customers.Add(defaultSelectedCombobox); output.Customers = customers; //PRODUCTION STATUS LOOKUP var productionStatuses = _lookup_productionStatusRepository .GetAll() .Select(s => new ComboboxItemDto(s.Id.ToString(), s.Name)) .ToList(); output.ProductionStatuses = productionStatuses; //EMPTY SALES ORDER salesOrderDto.Id = null; salesOrderDto.Number = ""; salesOrderDto.Date = DateTime.Now; salesOrderDto.Deadline = DateTime.Now; output.SalesOrder = salesOrderDto; //EMPTY SALES ORDER LINE salesOrderLineDto.Id = 0; salesOrderLineDto.Name = ""; salesOrderLineDto.Description = ""; salesOrderLineDto.MarkForDelete = false; salesOrderLineDtoList.Add(salesOrderLineDto); output.SalesOrderLines = salesOrderLineDtoList; //EMPTY SALES INVOICE ADDTIONAL COST salesInvoiceAdditionalCostDto.Id = 0; salesInvoiceAdditionalCostDto.Name = ""; salesInvoiceAdditionalCostDto.Description = ""; salesInvoiceAdditionalCostDto.MarkForDelete = false; salesInvoiceAdditionalCostDtoList.Add(salesInvoiceAdditionalCostDto); output.SalesInvoiceAdditionalCosts = salesInvoiceAdditionalCostDtoList; //EMPTY SALES INVOICE PAYMENT salesInvoicePaymentDto.Id = 0; salesInvoicePaymentDto.Date = DateTime.Now; salesInvoicePaymentDto.MarkForDelete = false; salesInvoicePaymentDtoList.Add(salesInvoicePaymentDto); output.SalesInvoicePayments = salesInvoicePaymentDtoList; //PAYMENT METHOD LOOKUP //var paymentMethod = _lookup_paymentMethodRepository // .GetAll() // .Select(c => new ComboboxItemDto(c.Id.ToString(), c.Name )) // .ToList(); //paymentMethod.Add(defaultSelectedCombobox); // ViewData["PaymentMethod"] = paymentMethod; //var paymentMethod = _paymentMethodRepo.GetAll().OrderBy(p => p.Name); //ViewData["PaymentMethod"] = new SelectList(paymentMethod, "ID", "Name"); //RETURN return(output); }