public IActionResult DefineWebSite(WebSiteDto model) { ViewBag.StatusList = GetStatusList.GetList(); if (!ModelState.IsValid) { return(View(model)); } var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; model.UserId = Convert.ToInt32(userId); _webSiteService.CreateOrUpdate(model); return(RedirectToAction("WebSiteList", "Home")); }
public IActionResult DefineWebSite(int?id) { ViewBag.StatusList = GetStatusList.GetList(); if (!id.HasValue) { return(View(new WebSiteDto())); } var model = _webSiteService.Get(Convert.ToInt32(id)); var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; if (model?.UserId == Convert.ToInt32(userId)) { return(View(model)); } return(RedirectToAction("HandleErrorCode", "Error", new { statusCode = "404" })); }