示例#1
0
        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);
        }
示例#3
0
 public bool Add(Catagory catagory)
 {
     return(_catagoryRepository.Add(catagory));
 }