コード例 #1
0
        public ActionResult Edit(UserQueryModel query_model)
        {
            var user = Example.Web.Data.User.AsQueryable().Where(x => x._id == query_model.Id).FirstOrDefault();

            if (user != null)
            {
                var model = new UserEditModel();

                model.Id = user._id;
                model.Username = user.Username;
                model.Email = user.Email;
                model.Comment = user.Comment;
                model.IsApproved = user.IsApproved;
                model.IsLockedOut = user.IsLockedOut;
                model.CreationDate = user.CreationDate;
                model.LastLoginDate = user.LastLoginDate;
                model.LastActivityDate = user.LastActivityDate;
                model.LastPasswordChangedDate = user.LastPasswordChangedDate;
                model.LastLockedOutDate = user.LastLockedOutDate;

                model.Roles = new List<string>();

                if (user.RoleAssignment != null)
                {
                    foreach (var role in user.RoleAssignment)
                    {
                        model.Roles.Add(role.Name);
                    }
                }

                return View(model);
            }

            return HttpNotFound();
        }
コード例 #2
0
        public ActionResult Password(UserQueryModel query_model)
        {
            User user = Example.Web.Data.User.AsQueryable().Where(x => x._id == query_model.Id).FirstOrDefault();

            if (user != null)
            {
                UserPasswordModel model = new UserPasswordModel();

                model.Id = user._id;
                model.Username = user.Username;

                return View(model);
            }

            return HttpNotFound();
        }