예제 #1
0
 public BidResponseDto TryToBid(BidRequestDto dto)
 {
     throw new NotImplementedException();
 }
        public IHttpActionResult TryToAddBid(BidRequestDto dto)
        {
            var bidder = this.uow.Bidders.GetAll().Where(x => x.Email.ToLower() == Username.ToLower()).Single();
            var bid = new Bid() {
                BidderId = bidder.Id,
                Description = dto.Description,
                WeddingId = dto.WeddingId,
                Price = dto.Price
            };

            this.repository.Add(bid);
            this.uow.SaveChanges();

            var response = new BidResponseDto(bid);
            var context = GlobalHost.ConnectionManager.GetHubContext<BidHub>();
            context.Clients.All.onBiddAdded(new { Data = response });
            return Ok(response);
        }