// GET: Core/users/Create
        public ActionResult Create()
        {
            Core.Models.user newuser = new user();
            if (TempData.ContainsKey("CREATELOGINCONFIG"))
            {
                CreateLoginConfig actionConfig = (CreateLoginConfig)TempData.Peek("CREATELOGINCONFIG");
                newuser.Fullname = actionConfig.AccntName;
                newuser.Remarks  = actionConfig.AccntRemarks;
            }

            return(View(newuser));
        }
        public ActionResult Create([Bind(Include = "Id,UserId,Fullname,Remarks,Email,Password,Status")] user user)
        {
            if (ModelState.IsValid)
            {
                ApplicationUserManager _UserManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
                var newuser = new ApplicationUser {
                    UserName = user.Email, Email = user.Email
                };

                try
                {
                    var result = _UserManager.Create(newuser, user.Password);

                    if (result.Succeeded)
                    {
                        user.Status = "ACT";
                        user.UserId = newuser.Id;

                        db.users.Add(user);
                        db.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                    ViewBag.errorMsg = e.Message;
                }

                if (TempData.ContainsKey("CREATELOGINCONFIG"))
                {
                    CreateLoginConfig actionConfig = (CreateLoginConfig)TempData["CREATELOGINCONFIG"];
                    return(RedirectToAction(actionConfig.ActionAfterCreate, actionConfig.ControllerAfterCreate, new { area = actionConfig.AreaAfterCreate, data = newuser.Id }));
                }

                return(RedirectToAction("Index"));
            }

            return(View(user));
        }