示例#1
0
        public void AccountController_AdminLogin_Test02()
        {
            // Initialization
            AccountController ctl = new AccountController();
            users model = new users();
            string url = "http://getskills.azurewebsites.net/";

            // To test if it is null
            var result = ctl.AdminLogin(model, url);
            Assert.IsNotNull(result);
        }
示例#2
0
        public ActionResult AdminLogin(users model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            List<users> storyList = (from u in db.users
                                    where u.email_address == model.email_address &&
                                    u.user_pswd == model.user_pswd &&
                                    u.user_type == "1"
                                    select u).ToList();
            if(storyList.Count > 0)
            {
                //return View(storyList.First());
                return RedirectToAction("Index", "SuccessStory", new { sortOrder = "ID_asc" });
            }
            else
            {
                return View(model);
            }
        }