public ActionResult Login(UserMaster model)
        {
            if (ModelState.IsValid)
            {
                string uname = model.Username;

                string pass = model.Password;
                using (var dbcon = new SchoolMngtDBContext(ConfigurationManager.ConnectionStrings["CodeFirstSchoolMngtConnString"].ToString()))
                {
                    var query = (from s in dbcon.tblUserMaster
                                 where s.Username.Equals(uname) && s.Password == pass
                                 select s).ToList();
                }
            }

            return(View());
        }
Ejemplo n.º 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            Database.SetInitializer(new SchoolMngtContextInitializer());

            string constr = ConfigurationManager.ConnectionStrings["CodeFirstSchoolMngtConnString"].ToString();
            var    dbcon  = new SchoolMngtDBContext(constr);

            //using (var dbcon = new SchoolMngtDBContext(constr))
            //{
            //    DomainClasses.UserMaster admin = new DomainClasses.UserMaster();
            //    admin.Username = "******";
            //    admin.Password = "******";
            //    dbcon.tblUserMaster.Add(admin);

            //    dbcon.SaveChanges();
            //}
        }