Example #1
0
 // 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());
 }
Example #2
0
        // 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"));
            }
        }
Example #3
0
 // 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"));
     }
 }
Example #4
0
        // 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));
        }
Example #5
0
 // GET: api/Categories
 public List <ICategoryModel> Get()
 {
     return(categoryData.GetAll());
 }
Example #6
0
 // GET: api/Areas
 public List <IAreaModel> Get()
 {
     return(areaData.GetAll());
 }