예제 #1
0
 public override string GetActualTrades()
 {
     using (AuctionContext db = new AuctionContext())
     {
         List <Trade> trades = db.Trades.Where(n => n.MaxBetAccountId == 0).ToList();
         SendSingleMessage(methods.SendDefaultResponse(), trades);
     }
     return(null);
 }
예제 #2
0
 public override string GetProductById()
 {
     using (AuctionContext db = new AuctionContext())
     {
         int     id      = GetParametr <int>();
         Product product = db.Products.Find(id);
         SendSingleMessage(methods.SendDefaultResponse(), product);
     }
     return(null);
 }
예제 #3
0
        public override string GetNextProduct()
        {
            int id = GetParametr <int>();

            using (AuctionContext db = new AuctionContext())
            {
                Product product = Work.Products.Get(n => n.ProductID == id).FirstOrDefault();
                SendSingleMessage(methods.SendDefaultResponse(), product);
            }
            return(null);
        }
예제 #4
0
 public MainWindowViewModel()
 {
     using (AuctionContext db = new AuctionContext())
     {
         if (db.Trades.Count() == 0)
         {
             TradesList = new ObservableCollection <Trade>();
         }
         else
         {
             TradesList = new ObservableCollection <Trade>(db.Trades);
         }
     }
     DateTime time = DateTime.Now;
 }
예제 #5
0
 public override string SetProductPhoto()
 {
     using (AuctionContext db = new AuctionContext())
     {
         int      id      = GetParametr <int>();
         var      product = db.Products.Where(n => n.ProductID == id).FirstOrDefault();
         string[] ext     = product.ImgSrc.Split('.');
         string   path    = "Photos/" + id + "." + ext.Last();
         while (!clientObject.IsFullImage)
         {
             ;
         }
         File.WriteAllBytes(path, clientObject.ImageBytes);
         clientObject.IsFullImage = false;
         product.ImgSrc           = path;
         db.SaveChanges();
         SendSingleMessage(methods.SendDefaultResponse(), true);
     }
     return(null);
 }
예제 #6
0
 public EFGenericRepository(AuctionContext context)
 {
     _context = context;
     _dbSet   = context.Set <TEntity>();
 }