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); }
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); }
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); }
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; }
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); }
public EFGenericRepository(AuctionContext context) { _context = context; _dbSet = context.Set <TEntity>(); }