public IActionResult Create()
        {
            ViewBag.countrylist = _unitofWork.country.GetAll().ToList();
            var model = new cityViewModel();

            return(View(model));
        }
        public async Task <IActionResult> Create(cityViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new city
                {
                    id = model.id
                    ,
                    Name = model.Name
                    ,
                    stateid = model.stateid

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.city.Add(objcategory);
                _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
        public async Task <IActionResult> Edit(cityViewModel model)
        {
            if (ModelState.IsValid)
            {
                var storeobj = _unitofWork.city.Get(model.id);
                if (storeobj == null)
                {
                    TempData["error"] = "Record Not Found";
                    return(NotFound());
                }
                storeobj.id      = model.id;
                storeobj.Name    = model.Name;
                storeobj.stateid = model.stateid;


                _unitofWork.city.Update(storeobj);
                _unitofWork.Save();
                TempData["success"] = "Record Update successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
        public IActionResult Edit(int id)
        {
            ViewBag.countrylist = _unitofWork.country.GetAll().ToList();
            var objcategory = _unitofWork.city.Get(id);

            if (objcategory == null)
            {
                return(NotFound());
            }
            var model = new cityViewModel()
            {
                id        = objcategory.id,
                Name      = objcategory.Name,
                stateid   = objcategory.stateid,
                countryid = _unitofWork.state.Get(objcategory.stateid).countryid,
                isactive  = objcategory.isactive,
                isdeleted = objcategory.isdeleted
            };

            ViewBag.States = _unitofWork.state.GetAll().Where(x => x.isdeleted == false && x.countryid == model.countryid);
            return(View(model));
        }