コード例 #1
0
 public string AddCategory(CategoryModel aCategory)
 {
     if (addCategory.IsExistsCategory(aCategory.CategoryName))
     {
         return("Category Name Already Exist,Please Input Another Category");
     }
     else
     {
         rowAffect = addCategory.AddCategory(aCategory);
         if (rowAffect == 1)
         {
             return("Category Added Succesfuly");
         }
         else
         {
             return("Category Added Failed");
         }
     }
 }
コード例 #2
0
        public string Save(Category category)
        {
            bool IsExistsCategory = setupCategoryGateway.IsExistsCategory(category.CategoryName);

            if (IsExistsCategory)
            {
                return("Category already exist! Try another category.");
            }
            else
            {
                int rowAffect = setupCategoryGateway.Save(category);
                if (rowAffect > 0)
                {
                    return("Category saved succesfully!");
                }
                else
                {
                    return("Failed to save category!");
                }
            }
        }