public ActionResult Index(Guid?id) { RegionTo gelen = rs.GetByID((Guid)id); ViewBag.RegionToName = gelen.Name; ViewBag.RegionToID = gelen.ID; return(View(ds.GetDefault(m => m.RegionToID == id))); }
public JsonResult Semtbilgisi(Guid id) { var data = new SelectList(semtservisi.GetDefault(m => m.CountryID == id), "ID", "DistrictName"); var ilk = new SelectListItem { Text = "Seçiniz", Value = "0" }; List <SelectListItem> lists = new List <SelectListItem>(); lists.Add(ilk); foreach (var item in data) { lists.Add(item); } ViewData["CountryID"] = lists; return(Json(ViewData["CountryID"], JsonRequestBehavior.AllowGet)); }
public JsonResult Categories(Guid?id, string durum) { if (id != null) { if (durum == "Reg") { var data = new SelectList(rs.GetDefault(m => m.ProvinceID == id), "ID", "Name").ToList(); var ilk = new SelectListItem { Text = "Seçiniz", Value = "0", Selected = true }; List <SelectListItem> lists = new List <SelectListItem>(); lists.Add(ilk); foreach (var item in data) { lists.Add(item); } ViewData["RegionID"] = lists; return(Json(ViewData["RegionID"], JsonRequestBehavior.AllowGet)); } else if (durum == "Dis") { var data = new SelectList(ds.GetDefault(m => m.RegionToID == id), "ID", "Name").ToList(); var ilk = new SelectListItem { Text = "Seçiniz", Value = "0", Selected = true }; List <SelectListItem> lists = new List <SelectListItem>(); lists.Add(ilk); foreach (var item in data) { lists.Add(item); } ViewData["DistrictID"] = lists; return(Json(ViewData["DistrictID"], JsonRequestBehavior.AllowGet)); } else if (durum == "Roa") { var data = new SelectList(rds.GetDefault(m => m.DistrictID == id), "ID", "Name").ToList(); var ilk = new SelectListItem { Text = "Seçiniz", Value = "0", Selected = true }; List <SelectListItem> lists = new List <SelectListItem>(); lists.Add(ilk); foreach (var item in data) { lists.Add(item); } ViewData["RoadID"] = lists; return(Json(ViewData["RoadID"], JsonRequestBehavior.AllowGet)); } else if (durum == "Str") { var data = new SelectList(ss.GetDefault(m => m.RoadID == id), "ID", "Name").ToList(); var ilk = new SelectListItem { Text = "Seçiniz", Value = "0", Selected = true }; List <SelectListItem> lists = new List <SelectListItem>(); lists.Add(ilk); foreach (var item in data) { lists.Add(item); } ViewData["StreetID"] = lists; return(Json(ViewData["StreetID"], JsonRequestBehavior.AllowGet)); } else if (durum == "Bui") { var data = new SelectList(bs.GetDefault(m => m.StreetID == id), "ID", "Name").ToList(); var ilk = new SelectListItem { Text = "Seçiniz", Value = "0", Selected = true }; List <SelectListItem> lists = new List <SelectListItem>(); lists.Add(ilk); foreach (var item in data) { lists.Add(item); } ViewData["BuildID"] = lists; return(Json(ViewData["BuildID"], JsonRequestBehavior.AllowGet)); } } var indexfirst = new SelectListItem { Text = "Seçiniz", Value = "0", Selected = true }; List <SelectListItem> liste = new List <SelectListItem>(); liste.Add(indexfirst); ViewData["RegionID"] = liste; ViewData["DistrictID"] = liste; ViewData["RoadID"] = liste; ViewData["StreetID"] = liste; ViewData["BuildID"] = liste; return(Json(ViewData["RegionID"], JsonRequestBehavior.AllowGet)); }