Пример #1
0
        public ActionResult Shops(SearchShopCondition condition)
        {
            var shops = BS.GetShops(condition);

            return(new JsonResult()
            {
                Data = shops
            });
        }
Пример #2
0
 public List <ShopInfo> GetShops(SearchShopCondition condition)
 {
     using (var uow = GetUnitOfWork())
     {
         var shops =
             uow.Repository <ZY_Shop>()
             .Query()
             .Filter(x => x.ShopStatus == 1)
             .Include(x => x.ZY_Shop_Img)
             .Get()
             .ToList();
         return(shops.Select(x => new ShopInfo()
         {
             shopId = x.ShopId,
             shopName = x.Name,
             description = x.Address,
             imageUrl = x.ZY_Shop_Img.Select(i => i.Url).FirstOrDefault(),
             //x.ZY_Shop_Img.Count()>0?x.ZY_Shop_Img.First().Url:"", //todo
             d = GetLantitudeLongitudeDist(condition.Longitude, condition.Latitude, x.Longitude, x.Latitude)
         }).OrderBy(x => x.d).ToList());
     }
 }