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()); }
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); }