public async Task <IActionResult> Create([Bind("Code,Name,Photo,Price")] ProductCreateRequestModel productCreateRequestModel) { if (ModelState.IsValid) { await _productCatalogService.CreateProduct(productCreateRequestModel); } return(RedirectToAction("Index")); }
public async Task <ActionResult> Create(CreateProductViewModel createProductViewModel) //IFormCollection collection { try { await _service.CreateProduct(ProductFactory.Make(createProductViewModel)); return(RedirectToAction(nameof(Index))); } catch (Exception exc) { return(View("Error", new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier, Description = exc?.Message })); } }