public IActionResult Update(int id, DistrictsModel updateModel) { var districtFromRepo = _services.GetByID(id); _mapper.Map(updateModel, districtFromRepo); _services.Update(districtFromRepo); _services.SaveChange(); return(Ok(updateModel)); }
// GET: Districts public ActionResult Index(short countryId = 0, short provinceId = 0, string districtName = "", int page = 1) { int rowCount = 0; var model = new DistrictsModel { ListDistricts = new Districts { CountryId = countryId, ProvinceId = provinceId, DistrictName = districtName }.GetPage(_userId, CmsConstants.RowAmount20, page > 0?page - 1:page, string.Empty, ref rowCount), ListProvinces = countryId > 0 ? new Provinces().GetList(countryId) : new List <Provinces>(), RowCount = rowCount, Pagination = new PaginationModel { TotalPage = rowCount, PageSize = CmsConstants.RowAmount20, LinkLimit = 5, PageIndex = page } }; return(View(model)); }