Ejemplo n.º 1
0
        public ActionResult GetThanhphoByTinh(string matinh)
        {
            List <Thanhpho> thanhphos = new List <Thanhpho>();

            if (!string.IsNullOrWhiteSpace(matinh))
            {
                thanhphos = _thanhphoRepository.ListThanhphoByTinh(matinh).ToList();
                if (thanhphos.Count() == 0)
                {
                    var empty = new Thanhpho
                    {
                        Matp  = "",
                        Tentp = "Không có thông tin"
                    };
                    thanhphos.Insert(0, empty);
                }
                else
                {
                    var empty = new Thanhpho
                    {
                        Matp  = "",
                        Tentp = "-- Chọn thông tin --"
                    };
                    thanhphos.Insert(0, empty);
                }
            }

            return(Json(thanhphos));
        }
Ejemplo n.º 2
0
        public IActionResult listThanhphoByTinh(string matinh)
        {
            var listtp = _thanhphoRepository.ListThanhphoByTinh(matinh);
            var tinh   = _thanhphoRepository.ListTinh().Where(x => x.Matinh == matinh).FirstOrDefault();

            ViewBag.tentinh = tinh.Tentinh;
            return(PartialView(listtp));
        }