public async Task <IActionResult> Edit() { if (RouteData.Values.ContainsKey("Id")) { var user = await GetCurrentUserAsync(); var siteId = user.SiteID; string key; key = RouteData.Values["Id"].ToString(); Location model = _repository.GetLocation(key, siteId); return(View(model)); } else { return(RedirectToAction("list")); } }