Example #1
0
        public async Task <IActionResult> Create(Delivery delivery)
        {
            if (ModelState.IsValid)
            {
                await _deliveriesRepository.Create(delivery);

                return(View(delivery));
            }
            ViewData["CategoryID"] = new SelectList(await _categoriesRepo.GetAll(), "Id", "Name", delivery.CategoryID);
            ViewData["ProductID"]  = new SelectList(await _productsRepo.GetAll(), "Id", "Name", delivery.ProductID);

            return(View(delivery));
        }