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

            result.SaleDetails.ForEach(u => u.Sale = null);
            return(result);
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create(CreateSaleInput input)
        {
            var result = await _saleService.CreateSaleAsync(input);

            return(new OperationActionResult(result));
        }
Ejemplo 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());
        }