コード例 #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();

        }
コード例 #2
0
        // 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);
            }
        }
コード例 #3
0
 public void AddItem(Auction auction)
 {
     _repo.Add(auction);
     _repo.SaveChanges();
 }