public bool UpdateBid(BidEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx.Bids.Single(e => e.BidId == model.BidId && e.OwnerId == _userId); entity.PayRate = model.PayRate; entity.PostingId = model.PostingId; return(ctx.SaveChanges() == 1); } }
public IHttpActionResult Put(BidEdit bid) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateBidService(); if (!service.UpdateBid(bid)) { return(InternalServerError()); } return(Ok()); }