// POST Auctions public int Post(Auction Auction) { return DataSource<Auction> .Command("AddAuction") .Parameter(new SqlParameter("Name", Auction.Name)) .ExecuteAndReturnId(); }
// PUT Auctions/7 public void Put(Auction Auction) { DataSource<Auction> .Command("UpdateAuction") .Parameter(new SqlParameter("Id", Auction.Id)) .Parameter(new SqlParameter("Name", Auction.Name)) .Execute(); }
private Auction DbToModel(IDataReader reader) { Auction obj = new Auction(); obj.Id = Convert.ToInt32(reader["Id"]); obj.OrganizationId = Convert.ToInt32(reader["OrgId"]); obj.Name = Convert.ToString(reader["Name"]); obj.AuctionDate = Convert.ToDateTime(reader["AuctionDate"]); return obj; }