Example #1
0
        public async Task <IActionResult> Create(ProductAdd productAdd)
        {
            if (ModelState.IsValid)
            {
                await _productApiService.AddAsync(productAdd);

                return(RedirectToAction("Index", "Home"));
            }
            return(View(productAdd));
        }
        public async Task <IActionResult> Create(ProductAdd productAdd)
        {
            if (ModelState.IsValid)
            {
                await _productApiService.AddAsync(productAdd);

                return(RedirectToAction("Index", "Home"));
            }
            ModelState.AddModelError("", "Something else wrong !");

            return(View(productAdd));
        }