Exemplo n.º 1
0
        public JsonResult Details(string name)
        {
            ToiletMapExport tmExport = CachingManager.CachedToiletMapExport;

            MyViewModel model = new MyViewModel();

            model.toiletDetail = tmExport.Items.FirstOrDefault(x => x.Name.ToUpper() == name.ToUpper());

            return Json(new { latitude = model.toiletDetail.Latitude, longitude = model.toiletDetail.Longitude, text = model.toiletDetail.Name }, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 2
0
        public ActionResult Search(MyViewModel model,int? page = 1)
        {
            const int pageSize = 5;
            int totalRecords = 0;
            ToiletMapExport tmExport = CachingManager.CachedToiletMapExport;
            int skip = page.HasValue ? page.Value - 1  : 1;

            model.toiletMap = tmExport.Items.Where(x => x.Town.ToUpper() == model.searchString.ToUpper()).OrderBy(o => o.Town).Skip(skip * pageSize).Take(pageSize);
            totalRecords = tmExport.Items.Where(x => x.Town.ToUpper() == model.searchString.ToUpper()).Count();
            model.pageSize = pageSize;
            model.pageNumber = Convert.ToInt16(page);
            model.totalRecords = totalRecords;
            model.jsonFlag = "Y";
            Session["toiletMap"] = model.toiletMap;
            Session["searchString"] = model.searchString;
            return View("Index",model);
        }
Exemplo n.º 3
0
 //
 // GET: /FindAToilet/
 public ActionResult Index()
 {
     MyViewModel model = new MyViewModel();
     return View(model);
 }