Esempio n. 1
0
        public void ProcessUpdate(AdminPageModel _data)
        {
            if (_data.User != null)
            {
                UserDAO userUpdate = new UserDAO();

                if (_data.User.club != null)
                {
                    userUpdate.SaveMemberClub(_data.User);
                }
                if (_data.User.userType != null)
                {
                    userUpdate.SaveUserType(_data.User);
                }
                if (_data.User.isMember != null)
                {
                    userUpdate.SaveMemberStatus(_data.User);
                }
            }

            if (_data.Club != null)
            {
                ClubDAO clubUpdate = new ClubDAO();

                clubUpdate.SaveClub(_data.Club);
            }
        }
Esempio n. 2
0
        public IActionResult AdminPage()
        {
            if (this.t)
            {
                t = false;
                return(View(this.AdminPageModel));
            }

            AdminPageModel adminPageModel = new AdminPageModel();

            List <System.Security.Claims.Claim> c = User.Claims.Where(x => x.Type.Contains("mail")).ToList();
            string email   = c[0].Value;
            int    adminId = context.GetUserId(email);
            User   admin   = context.Users.Where(x => x.Id == adminId).ToList()[0];

            if (admin.Role != 1)
            {
                adminPageModel.IsValid = false;
                return(View(adminPageModel));
            }

            adminPageModel.IsValid = true;
            adminPageModel.AdminId = adminId;
            adminPageModel.Users   = GetActiveUsers(adminId);

            return(View(adminPageModel));
        }
Esempio n. 3
0
        public ActionResult Index() // This page lets the admin set the data into the database and correct rows
        {
            List <Chunk>   multis           = Data.GetMultis().Where(m => m.MultiComplete.HasValue && m.MultiComplete.Value == false).ToList();
            List <Country> unnamedCountries = Data.GetCountries().Where(m => m.Name == "").ToList();
            AdminPageModel model            = new AdminPageModel(multis, unnamedCountries);

            return(View(model));
        }
Esempio n. 4
0
        public IActionResult Index(AdminPageModel _data)
        {
            var _adminService = new AdminServices();

            _adminService.ProcessUpdate(_data);

            if (!string.IsNullOrEmpty(_data.Event.Title))
            {
                _eventDAO.DeleteEvent(_data.Event);
            }

            return(RedirectToAction("Index"));
        }
Esempio n. 5
0
        public ActionResult Delete(int id, int adminId)
        {
            context.Users.Where(x => x.Id == id).ToList()[0].Role = -2;
            context.SaveChanges();

            AdminPageModel adminPageModel = new AdminPageModel();

            adminPageModel.IsValid = true;
            adminPageModel.AdminId = adminId;
            adminPageModel.Users   = GetActiveUsers(adminId);

            this.AdminPageModel = adminPageModel;
            this.t = true;
            return(RedirectToAction("AdminPage"));
        }
Esempio n. 6
0
        public ActionResult AddItem(AdminPageModel PostedPage)
        {
            var CategoriesList = _categoryService.GetSelectedCategory(PostedPage.taggles);

            var Item = new ItemModel()
            {
                Number      = PostedPage.NewItem.Number,
                Name        = PostedPage.NewItem.Name,
                Price       = PostedPage.NewItem.Price,
                Description = PostedPage.NewItem.Description
            };

            _itemService.Add(Item, CategoriesList);

            return(RedirectToAction("Index", "Article"));
        }