Esempio n. 1
0
        public ActionResult UserDeleteConfirmed(DeleteUserModel model, Guid userId)
        {
            UserInfo nfo;
            using (TransactionScope trans = new TransactionScope())
            {
                MembershipUser usr = Membership.GetUser(userId);
                if (string.Compare(usr.UserName.ToLower(), Utils.S_ADMIN.ToLower()) == 0)
                {
                    ModelState.AddModelError("", "Tidak bisa menghapus user");
                    nfo = db.UserInfos.Single(p => p.UserId == userId);
                    GetOrgPosInfo(nfo);
                    return View(model);
                }

                try
                {
                    Membership.DeleteUser(usr.UserName);
                    trans.Complete();
                    return RedirectToAction("Index");
                }
                catch (Exception e)
                {
                    ModelState.AddModelError("", "Tidak bisa menghapus user. Error: " + e.Message);
                }
            }
            nfo = db.UserInfos.Single(p => p.UserId == userId);
            GetOrgPosInfo(nfo);
            return View(model);
        }
Esempio n. 2
0
        public ActionResult UserDelete(Guid userId)
        {
            MembershipUser usr = Membership.GetUser(userId);
            UserInfo nfo = db.UserInfos.Single(p => p.UserId == userId);
            DeleteUserModel model = new DeleteUserModel();
            model.UserName = nfo.aspnet_User.UserName;
            model.FullName = nfo.FullName;
            model.JobTitle = nfo.JobTitle;
            model.Email = usr.Email;
            model.IsRCP = nfo.IsRiskOwner;

            GetOrgPosInfo(nfo);
            return View(model);
        }