public ActionResult Create(User model)
        {
            //get the ISP Id of the creating user to use to create the other user
            var user = svc.GetISPUser(User.Identity.GetUserId());

            var existingUser = UserManager.FindByEmail(model.Email);

            if (existingUser != null)
            {
                ViewBag.UserExistsMessage = "The user with email " + model.Email + " already exists in the system.";
                return(View());
            }

            model.EmailConfirmed = true;
            model.ISPId          = user.ISPId;
            model.UserName       = model.Email;
            model.CreatedDate    = DateTime.Now;
            IdentityResult x = UserManager.Create(model, "password123");

            UserManager.AddToRole(model.Id, UserType.ISPUser.ToString());


            TempData["Notification"] = "User successfully created";
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult Index()
        {
            var user  = svc.GetISPUser(User.Identity.GetUserId());
            var model = new GriddingViewModel
            {
                ISPId = user.ISPId ?? 0
            };

            return(View(model));
        }
        public ActionResult Index()
        {
            var user = svc.GetISPUser(User.Identity.GetUserId());

            //if user isnt user type admin return to login screen
            if (!user.IsUserTypeAdmin)
            {
                return(RedirectToAction("Login", "Account"));
            }

            //set cookie for ISP Admin
            var userCookie = new HttpCookie("ISPAdmin", user.Id);

            userCookie.Expires.AddDays(1);
            HttpContext.Response.SetCookie(userCookie);

            var model = svc.GetProducts(user.Id, null);

            return(View(model));
        }
        public ActionResult Index()
        {
            var ispUser = svc.GetISPUser(User.Identity.GetUserId());

            return(View(ispUser.ISP));
        }