public async Task <List <OfferResponceModelWithName> > OffersAll(string id)
        {
            var offers = await offerService.All(id);

            var listing = await listingService.GetTitleAndSellerName(id);

            var result = new List <OfferResponceModelWithName>();

            foreach (var offerResponceModel in offers)
            {
                result.Add(new OfferResponceModelWithName
                {
                    Created    = offerResponceModel.Created,
                    CreatorId  = offerResponceModel.CreatorId,
                    Id         = offerResponceModel.Id,
                    ListingId  = offerResponceModel.ListingId,
                    Price      = offerResponceModel.Price,
                    SellerName = listing.SellerName,
                    BuyerName  = offerResponceModel.CreatorName,
                    Title      = listing.Title,
                });
            }

            return(result);
        }
        public IActionResult All()
        {
            var offerDtos = _service.All();

            return(Ok(offerDtos));
        }
Пример #3
0
 public async Task <ActionResult <List <OfferResponceModel> > > All(string id) =>
 await offerService.All(id);