コード例 #1
0
 public DateTime?GetLatest(string areaName)
 {
     return(AreaFMPriceRepository.GetAllIncluding(a => a.Area)
            .Where(a => a.Area.Name == areaName)
            .OrderByDescending(a => a.PublishTime)
            .Select(a => a.PublishTime)
            .Take(1).FirstOrDefault());
 }
コード例 #2
0
        public void Save(string areaName, DateTime publishTime, IEnumerable <FMPriceItem> prices)
        {
            var priceList = prices.ToList();

            SetFoodMaterial(priceList);
            if (priceList.Count < 1) // 没有价格信息
            {
                return;
            }

            Area        area = AreaRepository.FirstOrDefault(a => a.Name == areaName);
            AreaFMPrice afp  = new AreaFMPrice()
            {
                Area         = area,
                PublishTime  = publishTime,
                FMPriceItems = priceList
            };

            AreaFMPriceRepository.Insert(afp);
        }