// Form to create a new product public ActionResult Create() { try { ViewBag.CategoryID = new SelectList(categoryData.GetAll(), "ID", "Name"); } catch (Exception ex) { log.Error("Could't load categories from Database", ex); return(View("ErrorRetriveData")); } return(View()); }
// Menu where is a table with its products and available categories of products public ActionResult TableCategories(int?id, string order) { if (id != null) { try { // Joining list of categories and selected table to a single model mainPageModel.Categories = categoryData.GetAll().OrderBy(x => x.Name).ToList(); ITableModel table = tableData.FindById((int)id); if (table == null) { log.Error("Could't find a table in the Database - return null"); return(View("ErrorTable")); } // Selection of the order of the list table.SoldProducts = MainMenuHelper.OrderListSoldProducts(table.SoldProducts, order); mainPageModel.Tables.Add(table); } catch (Exception ex) { log.Error("Could't load categories or tables from Database", ex); return(View("ErrorRetriveData")); } return(View(mainPageModel)); } else { log.Error("The table ID was null while trying to access"); return(View("ErrorTable")); } }
// Lists all categories public ActionResult Index() { try { return(View(categoryData.GetAll().OrderBy(x => x.Name))); } catch (Exception ex) { log.Error("Could't load categories from Database", ex); return(View("ErrorRetriveData")); } }
// Menu where is the list of all areas with its corresponding tables public ActionResult Tables() { try { // Joining list of areas and tables to a single model mainPageModel.Areas = areaData.GetAll().OrderBy(x => x.Name).ToList(); mainPageModel.Tables = tableData.GetAll().OrderBy(x => x.NumberOfTable).ToList(); } catch (Exception ex) { log.Error("Could't load areas or tables from Database", ex); return(View("ErrorRetriveData")); } return(View(mainPageModel)); }
// GET: api/Categories public List <ICategoryModel> Get() { return(categoryData.GetAll()); }
// GET: api/Areas public List <IAreaModel> Get() { return(areaData.GetAll()); }