コード例 #1
0
        public ActionResult Admin(RootModel model)
        {
            if (ModelState.IsValid)
            {
                var context = new ContextService();
                context.BaseDatos = model.DataBase;
                using (var service = new StartupService(context, model.DataBase))
                {
                    //Create user password
                    service.CreateAdmin(model.Password);
                    using (var lservice = new LoginService())
                    {
                        HttpCookie cookie;
                        lservice.Login(_dominio, ApplicationHelper.UsuariosAdministrador, model.Password, out cookie, ApplicationHelper.EmpresaMock, string.Empty, string.Empty);

                        Response.Cookies.Add(cookie);
                    }
                    return(RedirectToAction("DatosDefecto", new { id = model.DataBase }));
                }
            }
            return(View(model));
        }