Exemplo n.º 1
0
 public void DeleteRole(RoleDTOList roles)
 {
     PerformUpdateObjects <RoleDTOList, RoleDTO, Role>(roles, roleRepository, r => r.ID, (r, rdto) =>
     {
         r.Status = Wings.Domain.Model.Status.Deleted;
     });
 }
Exemplo n.º 2
0
 public RoleDTOList EditRole(RoleDTOList roles)
 {
     return(PerformUpdateObjects <RoleDTOList, RoleDTO, Role>(roles, roleRepository, r => r.ID, (r, rdto) =>
     {
         r.Name = rdto.Name;
         r.Description = rdto.Description;
         r.EditDate = DateTime.Now;
         r.Status = (Domain.Model.Status)rdto.Status;
     }).ToViewModel());
 }
Exemplo n.º 3
0
        /// <summary>
        /// 获取所有的角色
        /// </summary>
        /// <returns></returns>
        public RoleDTOList GetAllRoles()
        {
            RoleDTOList roledtolist = new RoleDTOList();
            var         roles       = roleRepository.GetAll();

            roles.ToList().ForEach(r =>
            {
                roledtolist.Add(Mapper.Map <Role, RoleDTO>(r));
            });
            return(roledtolist.ToViewModel());
        }
Exemplo n.º 4
0
        public ActionResult Edit(RoleDTO role)
        {
            Result result = new Result();

            result.message = "修改角色失败";
            using (ServiceProxy <IUserService> proxy = new ServiceProxy <IUserService>())
            {
                role.EditDate = DateTime.Now;
                RoleDTOList dtolist = new RoleDTOList();
                dtolist.Add(role);
                proxy.Channel.EditRole(dtolist);
                if (!string.IsNullOrEmpty(role.ID))
                {
                    result.success = true;
                    result.message = "修改角色成功";
                }
            }
            return(Json(result));
        }
Exemplo n.º 5
0
        public void DeleteRole(IDList roleid)
        {
            RoleDTOList roles = new RoleDTOList();
            Guid        temp  = Guid.Empty;

            roleid.ForEach(
                r =>
            {
                if (Guid.TryParse(r, out temp))
                {
                    roles.Add(new RoleDTO()
                    {
                        ID = temp.ToString()
                    });
                }
            }
                );
            PerformUpdateObjects <RoleDTOList, RoleDTO, Role>(roles, roleRepository, g => g.ID, (g, gdto) =>
            {
                g.Status = Wings.Domain.Model.Status.Deleted;
            });
        }
Exemplo n.º 6
0
 public RoleDTOList CreateRole(RoleDTOList roles)
 {
     return(PerformCreateObjects <RoleDTOList, RoleDTO, Role>(roles, roleRepository).ToViewModel());
 }