public ActionResult empresa(string nick, string pass, int?recordar)
        {
            bool check = false;

            if (recordar == 1)
            {
                check = true;
            }
            EFempresa omEmpresa = new EFempresa();


            try
            {
                short      idu     = omEmpresa.loguear(nick, pass, check);
                HttpCookie cookie  = new HttpCookie("usr", idu.ToString());
                HttpCookie cookien = new HttpCookie("name", omEmpresa.saludo(idu).ToString());
                cookie.Expires  = DateTime.Now.AddYears(1);
                cookien.Expires = DateTime.Now.AddYears(1);
                HttpCookieCollection cooks = new HttpCookieCollection();
                cooks.Add(cookie);  // Crea una cookie con el id del usuario.
                cooks.Add(cookien); // Crea una cookie con el nombre del usuario.
                Response.AppendCookie(cookie);
                Response.AppendCookie(cookien);
                ViewBag.LOGUED = true;



                return(RedirectToAction("Index", "Admin"));
            }
            catch (Exception e)
            {
                ViewBag.MENSAJE = "Usuario o contraseña no valida.\r";
                return(View("webuser"));
            }
        }
Esempio n. 2
0
        public ActionResult empresa(string nick, string pass, string nombre, string cif, string direccion, string telefono, string propietario, string email, string web, string serv, string trayectoria)
        {
            EFempresa omEmpresa = new EFempresa();

            try
            {
                omEmpresa.crearEmpresa(nick, pass, nombre, cif, direccion, telefono, propietario, email, web, serv, trayectoria);
            }
            catch (Exception e)
            {
                ViewBag.MENSAJE = e.Message;
                return(View("paginaError"));
            }


            return(RedirectToAction("Index"));
        }