Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(long id)
        {
            WebSite webSite = await _webSiteService.Get(id);

            if (webSite == null)
            {
                return(NotFound());
            }

            WebSiteViewModel viewModel = new WebSiteViewModel
            {
                CheckInterval = webSite.CheckInterval,
                Url           = webSite.Url
            };

            return(View(viewModel));
        }
Ejemplo n.º 2
0
        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" }));
        }