예제 #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();
        }