public bool Add(Catagory catagory) { if (catagory != null && catagory.Name.Length < 3) { throw new Exception("Invalid Name"); } bool isValid = catagoryRepository.Add(catagory); return(isValid); }
public bool Add(Category category) { bool isAdded = false; if (category.CategoryId == 0) { DataTable dt = categorySetupRepository.Show(); foreach (DataRow check in dt.Rows) { if (check["Name"].ToString() == category.CategoryName) { return(false); } } isAdded = categorySetupRepository.Add(category); } else { isAdded = categorySetupRepository.Update(category); } return(isAdded); }
public bool Add(Catagory catagory) { return(_catagoryRepository.Add(catagory)); }