using MvcApplication1.Models; using MvcApplication1.Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Security; namespace MvcApplication1.Controllers { public class LoginController : Controller { // // GET: /Login/ [HttpGet] public ActionResult Index() { return View(); } public ActionResult Login() { return View(); } [HttpPost] public ActionResult Login(Customer d) { using (CustomerDataEntities oe = new CustomerDataEntities()) { var user = oe.Customers.FirstOrDefault(a => a.Email.Equals(d.Email) && a.Password.Equals(d.Password)); if (user == null) { TempData["ErrorMessage"] = "Invalid user name or password."; return RedirectToAction("Login", "Login"); } else { return RedirectToAction("Index", "Home"); } } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)