//---Load all District  by Region Id
        public JsonResult GetDistrictByRegionId(int regionId)
        {
            var divisionId = _iRegionManager.GetAll().ToList().Find(n => n.RegionId == regionId).DivisionId;
            IEnumerable <District> districts = _iDistrictManager.GetAllDistrictByDivistionId(Convert.ToInt32(divisionId));

            return(Json(districts, JsonRequestBehavior.AllowGet));
        }
 // GET: Sales/Client/Edit/5
 public ActionResult Edit(int id)
 {
     try
     {
         Client client = _iClientManager.GetById(id);
         ViewBag.TerritoryId  = new SelectList(_iTerritoryManager.GetAll().ToList().FindAll(n => n.RegionId == client.RegionId), "TerritoryId", "TerritoryName");
         ViewBag.DistrictId   = new SelectList(_iDistrictManager.GetAllDistrictByDivistionId(client.DivisionId ?? default(int)), "DistrictId", "DistrictName");
         ViewBag.UpazillaId   = new SelectList(_iUpazillaGateway.GetAllUpazillaByDistrictId(client.DistrictId ?? default(int)), "UpazillaId", "UpazillaName");
         ViewBag.PostOfficeId = new SelectList(_iPostOfficeGateway.GetAllPostOfficeByUpazillaId(client.UpazillaId ?? default(int)), "PostOfficeId", "PostOfficeName");
         ViewBag.RegionId     = new SelectList(_iRegionManager.GetAll(), "RegionId", "RegionName");
         ViewBag.ClientTypeId = new SelectList(_iCommonManager.GetAllClientType(), "ClientTypeId", "ClientTypeName");
         return(View(client));
     }
     catch (Exception e)
     {
         if (e.InnerException != null)
         {
             ViewBag.Msg = e.InnerException.Message;
         }
         return(View());
     }
 }