Esempio n. 1
0
        /// <summary>
        /// Finds the product by ID and throws it back to the View
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IActionResult> Edit(int?id)
        {
            var product = await _robotoRepo.GetProductById(id);

            if (product == null)
            {
                return(RedirectToAction("ViewAll"));
            }
            return(View(product));
        }
Esempio n. 2
0
        /// <summary>
        /// Show the details of a product
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var foundProduct = await _robotoRepo.GetProductById(id);

            if (foundProduct == null)
            {
                return(NotFound());
            }

            return(View(foundProduct));
        }