public async Task <IHttpActionResult> Get()
        {
            var conditions   = _conditionAssembler.EntityToDto(await _conditionService.GetData(null));
            var genres       = _genreAssembler.EntityToDto(await _genreService.GetData(null));
            var productTypes = _productTypeAssembler.EntityToDto(await _productTypeService.GetData(null));

            var dto = new DictionaryDto()
            {
                Conditions   = conditions,
                Genres       = genres,
                ProductTypes = productTypes
            };

            return(Ok(dto));
        }
示例#2
0
 public ProductDto EntityToDto(product entity)
 {
     if (entity == null)
     {
         return(null);
     }
     return(new ProductDto()
     {
         Id = entity.ID,
         Name = entity.Name,
         ProductOwner = entity.product_owner,
         SoldCopies = entity.sold_copies,
         Stock = entity.stock,
         ConditionId = entity.condition_id,
         GenreId = entity.genre_id,
         Rating = entity.rating,
         ProductTypeId = entity.product_type_id,
         Condition = _conditionAssembler.EntityToDto(entity.dic_condition),
         Genre = _genreAssembler.EntityToDto(entity.dic_Genre),
         ProductType = _productTypeAssembler.EntityToDto(entity.dic_Product_type)
     });
 }