public void Save(mod.Bid bid) { Bid tc = _context.Bids.Find(bid.Id); tc.Amount = (decimal?)bid.BidAmount; tc.Timeofbid = bid.TimeOfBid; _context.SaveChanges(); }
public Bid Parse(mod.Bid bid) { Bid tc = new Bid(); tc.Amount = (decimal?)bid.BidAmount; tc.Timeofbid = bid.TimeOfBid; if (tc.Id == null) { tc.Id = bid.Id; } return(tc); }
public mod.Bid AddBid(mod.Bid newBid) { if (Exists(newBid.Id)) { newBid = _mapper.Parse(_context.Bids.Find(newBid.Id)); } else { _context.Bids.Add(_mapper.Parse(newBid)); _context.SaveChanges(); } return(newBid); }