Exemplo n.º 1
0
        public void EditItem(Auction auction)
        {
            var original = _repo.Find<Auction>(auction.Id);
            original.Name = auction.Name;
            original.Image = auction.Image;
            original.Description = auction.Description;
            original.NumberOfBids = auction.NumberOfBids;
            original.BidderName = auction.BidderName;
            _repo.SaveChanges();

        }
        // POST: api/Auction
        public IHttpActionResult Post(Auction item)
        {
            if(item == null)
            {
                return BadRequest("Missing BidAuction");
            }

            if (item.Id == 0)
            {
                _auctionService.AddItem(item);
                return Created("/auction/" + item.Id, item);
            }
            else
            {
                _auctionService.EditItem(item);
                return Ok(item);
            }
        }
Exemplo n.º 3
0
 public void AddItem(Auction auction)
 {
     _repo.Add(auction);
     _repo.SaveChanges();
 }