public ActionResult New()
        {
            if (TempData["success"] != null)
            {
                ViewBag.Success = TempData["success"].ToString();
                TempData.Remove("success");
            }
            if (TempData["error"] != null)
            {
                ViewBag.Error = TempData["error"].ToString();
                TempData.Remove("error");
            }

            var viewModel = new TinRaoViewModel
            {
                TinhThanhPhos   = _context.TinhThanhPhos.ToList(),
                QuanHuyens      = _context.QuanHuyens.ToList(),
                TrangThaiTinRao = SelectOptions.getTrangThaiTinRao,
                LoaiTinRaoBDS   = SelectOptions.getLoaiTinRaoBDS,
                LoaiNhaDats     = _context.LoaiNhaDats.ToList(),
                ThoiHanDangTins = SelectOptions.getThoiHanDangTin
            };

            return(View("TinRaoForm", viewModel));
        }
        public ActionResult Edit(int id)
        {
            var tinRao = _context.TinRaoBDSs.Include(x => x.TinhThanhPho).Include(x => x.QuanHuyen)
                         .Include(x => x.LoaiNhaDat).SingleOrDefault(x => x.Id == id);

            if (tinRao == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new TinRaoViewModel(tinRao)
            {
                TinhThanhPhos   = _context.TinhThanhPhos.ToList(),
                QuanHuyens      = _context.QuanHuyens.ToList(),
                TrangThaiTinRao = SelectOptions.getTrangThaiTinRao,
                LoaiTinRaoBDS   = SelectOptions.getLoaiTinRaoBDS,
                LoaiNhaDats     = _context.LoaiNhaDats.ToList(),
                ThoiHanDangTins = SelectOptions.getThoiHanDangTin
            };

            return(View("QuanLyTinRaoForm", viewModel));
        }