Exemple #1
0
        public IActionResult Register()
        {
            //Block for Registration Error Checking
            Microsoft.AspNetCore.Http.IFormCollection nvc = Request.Form; //source https://stackoverflow.com/questions/564289/read-post-data-submitted-to-asp-net-form
            string userName = "", password = "", email = "";
            bool   UNSet = false, PWSet = false, ESet = false;

            if (!string.IsNullOrEmpty(nvc["RegisterUsername"]))
            {
                userName = nvc["RegisterUsername"];
                UNSet    = true;
            }
            else
            {
                RedirectToAction("Error", "Home");
            }

            if (!string.IsNullOrEmpty(nvc["RegisterPassword"]))
            {
                if (nvc["RegisterPassword"] == nvc["RegisterConfirmPassword"])
                {
                    password = nvc["RegisterPassword"];
                    PWSet    = true;
                }
            }
            {
                RedirectToAction("Error", "Home");
            }

            if (!string.IsNullOrEmpty(nvc["RegisterEmail"]))
            {
                email = nvc["RegisterEmail"];
                ESet  = true;
            }
            else
            {
                RedirectToAction("Error", "Home");
            }
            //End Registration Error Check Block


            if (UNSet == true && PWSet == true && ESet == true)
            {
                User newUser = new User(userName, password, email);

                DatabaseContext.Add(newUser);
                DatabaseContext.SaveChanges();
            }
            else
            {
                RedirectToAction("Error", "Home");
            }



            var context = new mypartysite.Model.Current();
            var currEvent = context.initialize();

            return(RedirectToAction("RegisterSuccess", "Home"));
        }
Exemple #2
0
        public IActionResult Login()
        {
            var context   = new mypartysite.Model.Current();
            var currEvent = context.initialize();

            return(RedirectToAction("ToDoLists", "Home"));
        }
Exemple #3
0
        public IActionResult ToDoLists()
        {
            var context   = new mypartysite.Model.Current();
            var currEvent = context.initialize();

            return(View(currEvent));
        }
Exemple #4
0
        public IActionResult Index()
        {
            bool Logged = isUserLoggedIn();

            if (Logged == false)
            {
                ViewBag.LoggedInQ = "False";
            }

            var context   = new mypartysite.Model.Current();
            var currEvent = context.initialize();

            return(View(currEvent));
        }
Exemple #5
0
        public IActionResult ToDoLists()
        {
            bool Logged = isUserLoggedIn();

            if (Logged == false)
            {
                ViewBag.LoggedInQ = "False";
            }
            else if (Logged == true)
            {
                ViewBag.LoggedInQ     = "True";
                ViewBag.UserName      = HttpContext.Session.Get("UserName");
                ViewBag.SecurityLevel = HttpContext.Session.Get("SecurityLevel");
                ViewBag.UserID        = HttpContext.Session.Get("UserID");
                ViewBag.Email         = HttpContext.Session.Get("Email");
            }

            var context   = new mypartysite.Model.Current();
            var currEvent = context.initialize();

            return(View(currEvent));
        }