Esempio n. 1
0
        public SalesTable CreateSale(CreateSaleRequest saleRequest)
        {
            var result = _saleService.CreateSaleAsync(saleRequest).Result;

            result.SaleDetails.ForEach(u => u.Sale = null);
            return(result);
        }
        public async Task <IActionResult> Create([Bind("SaleId,SellerId,TransactionAmount,DateOfSale")] SaleModel sale)
        {
            if (ModelState.IsValid)
            {
                await _saleService.CreateSaleAsync(sale);

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SellerId"] = new SelectList(await _sellerService.GetAllSellersAsync(), "SellerId", "FullName");
            return(View(sale));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create(CreateSaleInput input)
        {
            var result = await _saleService.CreateSaleAsync(input);

            return(new OperationActionResult(result));
        }
Esempio n. 4
0
        public async Task <IActionResult> Post(SaleViewModel sale)
        {
            await _saleService.CreateSaleAsync(sale.IdentificationNumber, sale.Sale.ToDictionary(x => x.ProductId, x => x.Quantity));

            return(Ok());
        }