Exemple #1
0
        public void UpdateCategory(Category category)
        {
            BidOnContext context = new BidOnContext();

            context.Entry(category).State = EntityState.Modified;
            context.SaveChanges();
        }
Exemple #2
0
        public void SaveCategory(Category category)
        {
            BidOnContext context = new BidOnContext();

            context.Categories.Add(category);
            context.SaveChanges();
        }
Exemple #3
0
        public void SaveAuction(Auction auction)
        {
            BidOnContext context = new BidOnContext();

            context.Auctions.Add(auction);
            context.SaveChanges();
        }
Exemple #4
0
        public bool LeaveComment(Comment comment)
        {
            BidOnContext context = new BidOnContext();

            context.Comments.Add(comment);

            return(context.SaveChanges() > 0);
        }
Exemple #5
0
        public void DeleteAuction(int Id)
        {
            BidOnContext context       = new BidOnContext();
            var          deleteAuction = context.Auctions.Find(Id);

            context.Entry(deleteAuction).State = EntityState.Deleted;
            context.SaveChanges();
        }
Exemple #6
0
        public bool AddBid(Bid bid)
        {
            BidOnContext context = new BidOnContext();

            context.Bids.Add(bid);

            return(context.SaveChanges() > 0);
        }
Exemple #7
0
        public int SavePicture(Picture picture)
        {
            var context = new BidOnContext();

            context.Pictures.Add(picture);
            context.SaveChanges();

            return(picture.Id);
        }
Exemple #8
0
        public void DeleteCategory(int Id)
        {
            BidOnContext context = new BidOnContext();

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

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

            context.SaveChanges();
        }
Exemple #9
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();
        }
Exemple #10
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();
        }