Пример #1
0
        public void UpdateCategory(Category category)
        {
            BidOnContext context = new BidOnContext();

            context.Entry(category).State = EntityState.Modified;
            context.SaveChanges();
        }
Пример #2
0
        public void DeleteAuction(int Id)
        {
            BidOnContext context       = new BidOnContext();
            var          deleteAuction = context.Auctions.Find(Id);

            context.Entry(deleteAuction).State = EntityState.Deleted;
            context.SaveChanges();
        }
Пример #3
0
        public void DeleteCategory(int Id)
        {
            BidOnContext context = new BidOnContext();

            var Deletecategory = context.Categories.Find(Id);

            context.Entry(Deletecategory).State = EntityState.Deleted;

            context.SaveChanges();
        }
Пример #4
0
        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();
        }
Пример #5
0
        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();
        }