コード例 #1
0
        public async Task <AuctionDto> CreateAuction(AuctionCreationDto auctionDto)
        {
            var auction = _mapper.Map <Auction>(auctionDto);

            _unitOfWork.Auction.CreateAuction(auction);
            await _unitOfWork.SaveAsync();

            auction = await _unitOfWork.Auction.GetAuctionAsync(auction.AuctionID, false);

            return(_mapper.Map <AuctionDto>(auction));
        }
コード例 #2
0
        public async Task <IActionResult> CreateAuction([FromBody] AuctionCreationDto auctionDto)
        {
            var createdAuction = await _auctionService.CreateAuction(auctionDto);

            return(CreatedAtRoute("GetAuction", new { id = createdAuction.AuctionID }, createdAuction));
        }