Пример #1
0
 public ActionResult AdvanceSearchMovie(String title, String actor, String realisator, String genre, String country, String language, String year)
 {
     using (var webflixContext = new WebflixContext())
     {
         return Json(webflixContext.AdvanceSearchMovie(title, actor, realisator, genre, country, language, year));
     }
 }
Пример #2
0
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            using (var webflixContext = new WebflixContext())
            {
                var films = webflixContext.FILMs.ToList().Take(30);
                return View(films);
            }
        }
Пример #3
0
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            var courriel = model.Courriel;
            var pwd = model.Password;
            WebflixContext context = new WebflixContext();
            var user = (Session["IDPERSONNE"] == null) ? context.PERSONNEs.Where(p => p.COURRIEL == courriel) : context.PERSONNEs.Where(p => p.IDPERSONNE == (int)Session["IDPERSONNE"]);
            var storedPwd = user.Select(u => u.MOTDEPASSE).FirstOrDefault();

            if (user.Count() == 1 && ValidateMD5Password(pwd, storedPwd))
            {
                Session["IDPERSONNE"] = user.Select(u => u.IDPERSONNE).First();
                Session["NOM"] = user.Select(u => u.NOM).First();
                Session["PRENOM"] = user.Select(u => u.PRENOM).First();
                return RedirectToAction("Index", "Home");
            }

            // If we got this far, something failed, redisplay form
            ModelState.AddModelError("", "The user name or password provided is incorrect.");
            return View(model);
        }