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; }
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(); } }
public static int AddAuction(Auctions item) { using (var ctx = new RentooloEntities()) { ctx.Auctions.Add(item); ctx.SaveChanges(); return(item.Id); } }