public HttpResponseMessage Bid(BidDTO bidDTO) { if (bidDTO.Listing.Bids.Count == 0) { } else { if (bidDTO.BidAmount <= bidDTO.Listing.Bids.Max(b => b.BidAmount)) { return(Request.CreateResponse(HttpStatusCode.Conflict)); } } Bid bidToAdd = mapper.CreateBidEntity(bidDTO); if (bidDTO.Listing.AuctionEndTime > System.DateTime.Now) { bidToAdd = bidRepo.BidOnListing(bidToAdd); } var response = Request.CreateResponse <ListingDetailDTO>(HttpStatusCode.Created, mapper.CreateListingDetailDTO(bidToAdd.Listing)); string uri = Url.Link("DefaultApi", new { id = bidToAdd.ListingId }); response.Headers.Location = new Uri(uri); return(response); }