예제 #1
0
        public async Task <IActionResult> DisableEnableRoleAsync([FromBody] DisableEnableRoleRequestDto request)
        {
            var roleBiz = new RoleBiz();
            var entity  = await roleBiz.GetAsync(request.RoleGuid);

            if (entity == null)
            {
                return(Failed(ErrorCode.UserData, "找不到数据"));
            }
            entity.LastUpdatedBy   = UserID;
            entity.LastUpdatedDate = DateTime.Now;
            entity.Enable          = request.Enable;
            var result = await roleBiz.UpdateAsync(entity);

            if (!result)
            {
                return(Failed(ErrorCode.UserData, "修改失败"));
            }
            return(Success());
        }