public ActionResult Index(Guid?id)
        {
            Street gelen = ss.GetByID((Guid)id);

            ViewBag.StreetName = gelen.Name;
            ViewBag.StreetID   = gelen.ID;
            return(View(bs.GetDefault(m => m.StreetID == id)));
        }
Ejemplo n.º 2
0
        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));
        }