public async Task <ActionResult <CityDto> > GetCity(int id) { var city = await _cityManager.GetById(id); if (city == null) { return(NotFound()); } // CityDto model from Business layer is used here. // In production environment, I would not use a model from Business layer // instead I will have the models created on the API layer and use those models for request and response payloads. return(city); }
public IActionResult Update(int?id) { if (HttpContext.Session.GetString("AdminId") != null) { if (id == null) { return(NotFound()); } City aCityDetails = _iCityManager.GetById(id); if (aCityDetails == null) { return(NotFound()); } ViewBag.CountryList = GetAllCountry(); return(View(aCityDetails)); } else { return(RedirectToAction("Index", "Home")); } }