public IActionResult EditProduct() { var model = new EditProductIndexModel { InputModel = new EditProductInputModel(), ProductCategories = this.shopDbUsageService.ExtractAllCategoriesNames(), AllProductsNames = this.shopDbUsageService.ExtractAllProductsNames(), }; return(this.View(model)); }
public async Task <IActionResult> EditProduct(EditProductIndexModel model) { if (this.ModelState.IsValid) { Tuple <string, string> tuple = await this.shopDbUsageService.EditProduct(model.InputModel); this.TempData[tuple.Item1] = tuple.Item2; } else { this.TempData["Error"] = ErrorMessages.InvalidInputModel; } return(this.RedirectToAction("EditProduct", "Shop")); }