コード例 #1
0
 public static void UpdateAllAuctionFields(Auctions oldItem, Auctions newItem)
 {
     oldItem.Name        = newItem.Name;
     oldItem.StartPrice  = newItem.StartPrice;
     oldItem.ImgUrls     = newItem.ImgUrls;
     oldItem.Description = newItem.Description;
     oldItem.DataEnd     = newItem.DataEnd;
 }
コード例 #2
0
 public static void UpdateAuction(Auctions newItem, int oldItemId)
 {
     using (var ctx = new RentooloEntities())
     {
         var updatedItem = ctx.Auctions.First(x => x.Id == oldItemId);
         UpdateAllAuctionFields(updatedItem, newItem);
         ctx.SaveChanges();
     }
 }
コード例 #3
0
        public static int AddAuction(Auctions item)
        {
            using (var ctx = new RentooloEntities())
            {
                ctx.Auctions.Add(item);

                ctx.SaveChanges();

                return(item.Id);
            }
        }