public IResult Update(Category category)
{
IResult result = BusinessRules.Run(
CheckIfCategoryNameDuplicate(category.CategoryName)
);
if (result != null) //hatalı kodlar kendi hata mesajıyla dönüyor, hatalı olmayanlara null döndük
{
return result; // hatalı logic, hata mesajı döner
}
_categoryDal.Update(category);
return new SuccessResult();
}
private IResult CheckIfCategoryNameDuplicate(string categoryName)