Example #1
0
        public ActionResult VerificaAcesso(string rLogin, string rSenha)
        {
            AspNetLivroEntities4 E = new AspNetLivroEntities4();
            Cliente x = new Cliente();
            Admin   y = new Admin();

            x = (from p in E.Cliente where p.Login == rLogin && p.Senha == rSenha select p).FirstOrDefault();
            y = (from p in E.Admin where p.Login == rLogin && p.Senha == rSenha select p).FirstOrDefault();
            if (x == null && y == null)
            {
                return(View("Index"));
            }
            else
            {
                if (y != null)
                {
                    Session["AdminNome"] = y.Nome;
                    Session["AdminID"]   = y.ID;
                    return(RedirectToAction("index", "Admin"));
                }
                if (x != null)
                {
                    Session["ClienteNome"] = x.Nome;
                    Session["ClienteID"]   = x.ID;
                    Model.Livro        a = new Model.Livro();
                    List <Model.Livro> b = new List <Model.Livro>();
                    b.Add(a);
                    Session["Carrinho"] = b;
                    return(RedirectToAction("index", "Cliente", x));
                }
                return(View("erro"));
            }
        }
Example #2
0
 public RepositorieLivrosVendidos()
 {
     E = new AspNetLivroEntities4();
 }
Example #3
0
 public RepositorieAdmin()
 {
     _E = new AspNetLivroEntities4();
 }
Example #4
0
 public RepositorieVenda()
 {
     E = new AspNetLivroEntities4();
 }
Example #5
0
 public RepositorieCliente()
 {
     e = new AspNetLivroEntities4();
 }