コード例 #1
0
        public IActionResult Create(User item)
        {
            Userrep rep = new Userrep();

            rep.Add(item);
            if (ModelState.IsValid)
            {
                return(RedirectToAction("Index"));//add model data to table
            }
            else
            {
                return(View());
            }
        }
コード例 #2
0
        public IActionResult Login(string uname, string password)
        {
            Userrep rep  = new Userrep();
            User    user = rep.Validate(uname, password);

            if (user != null)
            {
                return(RedirectToAction("Details"));
            }
            else
            {
                ViewData["err"] = "Invalid Credential";
                return(View());
            }
        }