예제 #1
0
        public IEnumerable <BikeDTO> GetBikes()
        {
            return(_bikeRepository.GetAll().Select(b =>
            {
                return new BikeDTO
                {
                    Id = b.Id,
                    Name = b.Name,
                    Type = b.Type,
                    Parts = b.Parts.Select(p =>
                    {
                        PartDTO part = new PartDTO
                        {
                            Id = p.Part.Id,
                            Name = p.Part.Name,
                            Description = p.Part.Description,
                            Functionality = p.Part.Functionality.ToString(),
                            IsOptional = p.Part.IsOptional,
                            DominantParts = p.Part.DominantParts.Select(dp => dp.DominantPart.Name).ToList(),
                            DependantParts = p.Part.DependantParts.Select(dp => dp.DependantPart.Name).ToList(),
                            BikeId = p.Part.BikeParts.Select(b => b.BikeId).ToList()
                        };

                        return part;
                    }).OrderBy(p => p.Name).ToList()
                };
            }).ToList());
        }
예제 #2
0
 public IEnumerable <BikeIndexDto> GetBikes()
 {
     return(_mapper.Map <IEnumerable <BikeIndexDto> >(_bikeRepository.GetAll()));
 }
예제 #3
0
 public async Task <List <Bike> > GetAllBikesAsync() => await _bikeRepository.GetAll().ToListAsync();
예제 #4
0
 public IEnumerable <Bike> GetAllBikes()                             // read all
 {
     return(_bikeRepository.GetAll());
 }
 public IEnumerable <Bike> GetBikes()
 {
     return(_bikeRepository.GetAll().OrderBy(b => b.Price));
 }