示例#1
0
        public static IEnumerable <PermissionStateDto> ToPermissionStateDtoCollection(IEnumerable <string> ids)
        {
            var states = new List <PermissionStateDto>();

            foreach (var id in ids)
            {
                var dto = new PermissionStateDto();
                dto.PermissionId = id;
                states.Add(dto);
            }
            return(states);
        }
示例#2
0
 public PermissionStateDto Get(string id, string fields = null)
 {
     try {
         var idObj = id;
         var state = (PermissionState)_permissionApplicationService.Get(idObj);
         if (state == null)
         {
             return(null);
         }
         var stateDto = new PermissionStateDto(state);
         if (String.IsNullOrWhiteSpace(fields))
         {
             stateDto.AllFieldsReturned = true;
         }
         else
         {
             stateDto.ReturnedFieldsString = fields;
         }
         return(stateDto);
     } catch (Exception ex) { var response = PermissionsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
 }