public void UpdateCategory(Category category) { BidOnContext context = new BidOnContext(); context.Entry(category).State = EntityState.Modified; context.SaveChanges(); }
public void DeleteAuction(int Id) { BidOnContext context = new BidOnContext(); var deleteAuction = context.Auctions.Find(Id); context.Entry(deleteAuction).State = EntityState.Deleted; context.SaveChanges(); }
public void DeleteCategory(int Id) { BidOnContext context = new BidOnContext(); var Deletecategory = context.Categories.Find(Id); context.Entry(Deletecategory).State = EntityState.Deleted; context.SaveChanges(); }
public void DeleteEntityComments(int entityId, int recordId) { BidOnContext context = new BidOnContext(); var auctioncomments = context.Comments.Where(c => c.EntityId == entityId && c.RecordId == recordId); foreach (var comment in auctioncomments) { context.Entry(comment).State = EntityState.Deleted; } context.SaveChanges(); }
public void UpdateAuction(Auction auction) { BidOnContext context = new BidOnContext(); var exitAuction = context.Auctions.Where(x => x.Id == auction.Id).Include(x => x.AuctionPictures).First(); context.AuctionPictures.RemoveRange(exitAuction.AuctionPictures); context.Entry(exitAuction).CurrentValues.SetValues(auction); context.AuctionPictures.AddRange(auction.AuctionPictures); context.SaveChanges(); }