private void ProductNameCheck(Product product) { bool isThereAnyProductNameWithSameName = _productDal.GetList(p => p.Name == product.Name).Any(); if (isThereAnyProductNameWithSameName) { throw new Exception("There is already a product with the same name."); } }
public void Delete(Product product) { _productDal.Delete(product); }
public void Update(Product product) { FluentValidatorTool.Validate(new ProductValidator(), product); ProductNameCheck(product); _productDal.Update(product); }
public ActionResult Add(Product product) { _productService.Add(product); TempData.Add("Message", "The product was successfully added"); return RedirectToAction("Index"); }