Пример #1
0
        public IActionResult Index(string lang)
        {
            SetLangPref(lang);
            //LINQ-queries & ViewBags
            ViewBag.UserRole     = GetUserRole();
            ViewBag.CategoryList = DBHandler.GetCategories();

            ViewBag.glossary  = GetGlossary(lang);
            ViewBag.lang      = lang != null ? lang : "EN";
            ViewBag.searchBar = DBHandler.GetLocations();
            GetMaps();
            return(View());
        }
Пример #2
0
        public IActionResult Index(int id, string lang)
        {
            string role = DBHandler.GetTempRole(this);

            if (role != "Teacher")
            {
                return(RedirectToAction("Index", "Login"));
            }
            ViewBag.glossary = GetGlossary(lang);
            ViewBag.lang     = lang != null ? lang : "EN";

            Location location = null;

            if (id != 0)
            {
                location               = DBHandler.GetLocations().FirstOrDefault(x => x.LocationId.Equals(id));
                location.Category      = DBHandler.GetCategories().FirstOrDefault(x => x.CategoryId.Equals(location.CategoryId));
                location.BuildingFloor = DBHandler.GetBuildingFloors().FirstOrDefault(x => x.BuildingFloorId.Equals(location.BuildingFloorId));
            }

            return(View(location));
        }