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(); Category model = _repository.GetCategory(key, siteId); return(View(model)); } else { return(RedirectToAction("list")); } }