Пример #1
0
 private AuctionItem DbToModel(IDataReader reader)
 {
     AuctionItem obj = new AuctionItem();
     obj.Id = Convert.ToInt32(reader["Id"]);
     obj.AuctionId = Convert.ToInt32(reader["AuctionId"]);
     obj.ParentItemId = 0;   // Convert.ToInt32(reader["ParentItemId"]);     // need to handle null value
     obj.Name = Convert.ToString(reader["ItemName"]);
     obj.Description= Convert.ToString(reader["ItemText"]);
     obj.ItemValue = Convert.ToDecimal(reader["ItemValue"]);
     obj.Qty = Convert.ToInt32(reader["Qty"]);
     obj.IsCertificate = Convert.ToBoolean(reader["IsCertificate"]);
     obj.IsReceived = Convert.ToBoolean(reader["IsReceived"]);
     return obj;
 }
Пример #2
0
 // POST AuctionItems
 public int Post(AuctionItem AuctionItem)
 {
     return DataSource<AuctionItem>
         .Command("AddAuctionItem")
         .Parameter(new SqlParameter("AuctionId", AuctionItem.AuctionId))
         .Parameter(new SqlParameter("ParentItemId", AuctionItem.ParentItemId))
         .Parameter(new SqlParameter("ItemName", AuctionItem.Name))
         .Parameter(new SqlParameter("ItemText", AuctionItem.Description))
         .Parameter(new SqlParameter("ItemValue", AuctionItem.ItemValue))
         .Parameter(new SqlParameter("Qty", AuctionItem.Qty))
         .Parameter(new SqlParameter("IsCertificate", AuctionItem.IsCertificate))
         .Parameter(new SqlParameter("IsReceived", AuctionItem.IsReceived))
         .ExecuteAndReturnId();
 }
Пример #3
0
 // PUT AuctionItems/7
 public void Put(AuctionItem AuctionItem)
 {
     DataSource<AuctionItem>
         .Command("UpdateAuctionItem")
         .Parameter(new SqlParameter("Id", AuctionItem.Id))
         .Parameter(new SqlParameter("ParentItemId", AuctionItem.ParentItemId))
         .Parameter(new SqlParameter("AuctionId", AuctionItem.AuctionId))
         .Parameter(new SqlParameter("ItemName", AuctionItem.Name))
         .Parameter(new SqlParameter("ItemText", AuctionItem.Description))
         .Parameter(new SqlParameter("ItemValue", AuctionItem.ItemValue))
         .Parameter(new SqlParameter("Qty", AuctionItem.Qty))
         .Parameter(new SqlParameter("IsCertificate", AuctionItem.IsCertificate))
         .Parameter(new SqlParameter("IsReceived", AuctionItem.IsReceived))
         .Execute();
 }