Exemple #1
0
        public IQueryable <LensHistory> GetTodaysHistory()
        {
            var today = DateTime.Now.Date;

            return
                (LensHistory.Where(x => x.InsertDate >= today && x.InsertDate <= DateTime.Today.AddDays(1).Date).OrderByDescending(x => x.InsertDate).Include(m => m.Material));
        }
Exemple #2
0
        public void UpdateHistory(string productLabel, int quantity)
        {
            var lens = Lenses.Where(l => l.ProductLabel == productLabel).Include(m => m.Material).ToList();

            LensHistory lensHistoryToUpdate = new LensHistory
            {
                ProductLabel          = lens[0].ProductLabel,
                Sphere                = lens[0].Sphere,
                Cylinder              = lens[0].Cylinder,
                AntiReflectiveCoating = lens[0].AntiReflectiveCoating,
                Transitions           = lens[0].Transitions,
                Material              = lens[0].Material,
                Quantity              = quantity,
                RemainingCount        = lens[0].RemainingCount,
                InsertDate            = DateTime.Now
            };

            LensHistory.Add(lensHistoryToUpdate);
            SaveChanges();
        }