static void Main(string[] args) { bool exit = false; while (!exit) { Console.WriteLine("Hello, Please Select Option"); Console.WriteLine("a. Category"); Console.WriteLine("b. Product"); Console.WriteLine("c. Exit App!"); char ch = Convert.ToChar(Console.ReadLine()); switch (ch) { case 'a': CategoryOperation.CategoryOperationMenu(); break; case 'b': ProductOperation.ProductOperationMenu(); break; case 'c': Console.WriteLine("Exit"); exit = true; break; default: Console.WriteLine("Invalid Selection"); break; } Console.Clear(); } }
public ActionResult InsertContentCategorySub(ContentCategoryModel u) { CategoryOperation co = new CategoryOperation(); if (u.ParentId == 0) { u.ParentsId = 0; u.CategoryLevel = 0; } else { ContentCategoryModel o = co.Get(u.ParentId); if (o.ParentsId == 0) { u.ParentsId = o.Id; } else { u.ParentsId = o.ParentsId; } u.CategoryLevel = o.CategoryLevel + 1; } co.Insert(u); return(JavaScript("pagesub();")); }
public ActionResult UpdateContentCategorySub(ContentCategoryModel model) { CategoryOperation co = new CategoryOperation(); co.Update(model); return(JavaScript("pagesub();")); }
public ActionResult DeleteContentCategory(int id) { CategoryOperation co = new CategoryOperation(); return(Content(co.Delete(id))); }
static void Main(string[] args) { Console.WriteLine("Please Select one the Options"); Console.WriteLine("1. Category"); Console.WriteLine("2. Product"); Console.WriteLine("3. Exit The App!"); char ch = Convert.ToChar(Console.ReadLine()); switch (ch) { case '1': CategoryOperation.CategoryOperationMenu(); break; case '2': ProductOperation.ProductOperationMenu(); break; case '3': return; default: Console.WriteLine("Invalid option Selected"); break; } }
public ActionResult UpdateContentCategory(int id) { CategoryOperation co = new CategoryOperation(); ContentCategoryModel u = co.Get(id); return(View(u)); }
public static void CategoryOperationMenu() { Console.WriteLine("Please Select Category Operation"); Console.WriteLine("1. Enter a Category"); Console.WriteLine("2. List all Categories"); Console.WriteLine("3. Search a Category"); Console.WriteLine("4. Delete a Category"); char op = Convert.ToChar(Console.ReadLine()); switch (op) { case '1': Console.WriteLine("Enter Category Name"); var categoryName = Console.ReadLine(); while (string.IsNullOrWhiteSpace(categoryName) || int.TryParse(categoryName, out _)) { Console.WriteLine("Please Enter Only Char and It can not be Empty"); categoryName = Console.ReadLine(); } Console.WriteLine("Enter Short Code"); var shortCode = Console.ReadLine(); Console.WriteLine("Enter Description"); var desc = Console.ReadLine(); while (string.IsNullOrWhiteSpace(desc) || int.TryParse(desc, out _)) { Console.WriteLine("Please Enter Only Char and It can not be Empty"); desc = Console.ReadLine(); } CategoryOperation.AddCategory(categoryName, shortCode, desc); break; case '2': CategoryOperation.GetAllCategory(); Console.ReadKey(); break; case '3': Console.WriteLine("Enter Category Name"); var searchCategoryName = Console.ReadLine(); while (string.IsNullOrWhiteSpace(searchCategoryName) || int.TryParse(searchCategoryName, out _)) { Console.WriteLine("Please Enter Only Char and It can not be Empty"); searchCategoryName = Console.ReadLine(); } CategoryOperation.SearchCategory(searchCategoryName); break; case '4': Console.WriteLine("Enter Category Id or Short Code"); break; default: Console.WriteLine("Invalid Selection"); CategoryOperationMenu(); break; } }
public ActionResult ContentCategoryList() { CategoryOperation co = new CategoryOperation(); List <ContentCategoryModel> list = co.GetList("", 1, 1000); List <ContentCategoryModel> resultList = new List <ContentCategoryModel>(); var l1 = list.FindAll(r => r.ParentId == 0); RecursionCategory(resultList, l1, list); return(View(resultList)); }
public MyBookController() { db = new BookEntities(); myBookOperation = new MyBookOperation(db); categoryOperation = new CategoryOperation(db); }
public CategoryController() { context = new DoYouNowTheseContext(); categoryOperation = new CategoryOperation(context); }
public static void CategoryOperationMenu() { Console.WriteLine("***Welcome to ProductCatalog, Please Select Category Operation***"); Console.WriteLine("a. Enter a Category"); Console.WriteLine("b. List all Categories"); Console.WriteLine("c. Search a Category"); Console.WriteLine("d. Delete a Category"); Console.WriteLine("e. Main Menu"); char ch1 = Convert.ToChar(Console.ReadLine()); switch (ch1) { case 'a': Console.WriteLine("Enter Category Name"); var categoryName = Console.ReadLine(); while (string.IsNullOrWhiteSpace(categoryName) || int.TryParse(categoryName, out _)) { Console.WriteLine("Please Enter Only Char and It can not be Empty"); categoryName = Console.ReadLine(); //break; } Console.WriteLine("Enter Short Code"); var shortCode = Console.ReadLine(); Console.WriteLine("Enter Description"); var desc = Console.ReadLine(); while (string.IsNullOrWhiteSpace(desc) || int.TryParse(desc, out _)) { Console.WriteLine("Please Enter Only Char and It can not be Empty"); desc = Console.ReadLine(); } CategoryOperation.AddCategory(categoryName, shortCode, desc); break; case 'b': CategoryOperation.GetAllCategory(); Console.ReadKey(); break; case 'c': Console.WriteLine("Enter Category Name"); var searchCategoryName = Console.ReadLine(); while (string.IsNullOrWhiteSpace(searchCategoryName) || int.TryParse(searchCategoryName, out _)) { Console.WriteLine("Please Enter Only Char and It can not be Empty"); searchCategoryName = Console.ReadLine(); } CategoryOperation.SearchCategory(searchCategoryName); break; case 'd': Console.WriteLine("Enter Product Name"); var DeleteCategoryName = Console.ReadLine(); while (string.IsNullOrWhiteSpace(DeleteCategoryName) || int.TryParse(DeleteCategoryName, out _)) { Console.WriteLine("Please Enter Only Char and It can not be Empty"); DeleteCategoryName = Console.ReadLine(); } CategoryOperation.DeleteCategory(DeleteCategoryName); break; case 'e': StartMenu.Menu(); break; default: Console.WriteLine("Invalid Selection!!"); CategoryOperationMenu(); break; } }
public CategoryController() { db = new BookEntities(); categoryOperation = new CategoryOperation(db); }