// GET: api
        public ActionResult CheckLogin(string Username, string Password)
        {
            Customer customer = Customer.CheckLogin(Username, Password);

            if (customer != null)
            {
                return(Content(JsonConvert.SerializeObject(new { result = "success", data = customer })));
            }
            else
            {
                return(Content(JsonConvert.SerializeObject(new { result = "error" })));
            }
        }
Esempio n. 2
0
        public ActionResult checklogin(string username, string password)
        {
            Customer customer = Customer.CheckLogin(username, password);

            if (customer != null)
            {
                Session["customer"] = customer;
                return(RedirectToAction("Index", "Home", new { id = customer.Id }));
            }
            else
            {
                return(RedirectToAction("Index", "Login", new { error = 2 }));
            }
        }