コード例 #1
0
        public IActionResult Edit(Guid id, MonitorViewModel monitor)
        {
            if (id != monitor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    Monitor entitiyMonitor = new Monitor
                    {
                        Url         = monitor.Url,
                        DisplayName = monitor.Name
                    };

                    _monitorService.Edit(entitiyMonitor);
                    _monitorService.Save();
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, "");
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AppUserId"] = UserId;
            return(View(monitor));
        }