Exemplo n.º 1
0
        public bool AddBid(Bid bid)
        {
            AmigosAuctionContext context = new AmigosAuctionContext();

            context.Bids.Add(bid);
            return(context.SaveChanges() > 0);
        }
Exemplo n.º 2
0
 public bool LeaveComment(Comment comment)
 {
     context = new AmigosAuctionContext();
     //Need to add EnityFramework from NuggetPackageManager
     context.Comments.Add(comment);
     return(context.SaveChanges() > 0);
 }
Exemplo n.º 3
0
 public void DeleteAuction(Auction auction)
 {
     context = new AmigosAuctionContext();
     context.Entry(auction).State = System.Data.Entity.EntityState.Deleted;
     //context.Auctions.Remove(auction);
     context.SaveChanges();
 }
Exemplo n.º 4
0
 public int SavePicture(Picture picture)
 {
     context = new AmigosAuctionContext();
     //Need to add EnityFramework from NuggetPackageManager
     context.Pictures.Add(picture);
     context.SaveChanges();
     return(picture.ID);
 }
Exemplo n.º 5
0
 //save
 public void SaveCategory(Category category)
 {
     try
     {
         context = new AmigosAuctionContext();
         //Need to add EnityFramework from NuggetPackageManager
         context.Categories.Add(category);
         context.SaveChanges();
     }
     catch (Exception e)
     {
         Console.Write(e.Message);
     }
 }
Exemplo n.º 6
0
 public void SaveAuction(Auction auction)
 {
     try
     {
         context = new AmigosAuctionContext();
         //Need to add EnityFramework from NuggetPackageManager
         context.Auctions.Add(auction);
         context.SaveChanges();
     }
     catch (Exception e)
     {
         Console.Write(e.Message);
     }
 }
Exemplo n.º 7
0
 //Delete
 public void DeleteCategory(Category category)
 {
     context = new AmigosAuctionContext();
     context.Entry(category).State = System.Data.Entity.EntityState.Deleted;
     context.SaveChanges();
 }
Exemplo n.º 8
0
 public Category GetCategoryByID(int?id)
 {
     context = new AmigosAuctionContext();
     return(context.Categories.Find(id));
 }
Exemplo n.º 9
0
 //List all
 public List <Category> GetCategories()
 {
     context = new AmigosAuctionContext();
     return(context.Categories.ToList());
 }
Exemplo n.º 10
0
 public void UpdateAuction(Auction auction)
 {
     context = new AmigosAuctionContext();
     context.Entry(auction).State = System.Data.Entity.EntityState.Modified;
     context.SaveChanges();
 }
Exemplo n.º 11
0
 public Auction GetAuctionByID(int?ID)
 {
     context = new AmigosAuctionContext();
     return(context.Auctions.Find(ID));
 }
Exemplo n.º 12
0
 public List <Auction> GetAuctions()
 {
     context = new AmigosAuctionContext();
     return(context.Auctions.ToList());
 }
Exemplo n.º 13
0
 public List <Auction> GetFeaturedAuctions()
 {
     context = new AmigosAuctionContext();
     return(context.Auctions.Take(4).ToList());
 }
Exemplo n.º 14
0
 public List <Comment> GetComments(int entityID, int recordID)
 {
     context = new AmigosAuctionContext();
     return(context.Comments.Where(x => x.EntityID == entityID && x.RecordID == recordID).ToList());
 }