예제 #1
0
        /// <summary>
        /// Updates the Target of the user.
        /// </summary>
        public async Task UpdateAsync(UpdateTargetBindingModel model, ClaimsPrincipal user)
        {
            var userId = _userService.GetUserId(user);

            var targetDto = new TargetDto
            {
                Id = model.Id,
                MonitoringInterval = model.MonitoringInterval,
                Name = model.Name,
                Url  = model.Url
            };

            var jobId = await GetJobIdByTargetId(model.Id);

            _jobService.SaveHealtCheckJob(model.Url, jobId, model.MonitoringInterval, model.Id, userId, user.Identity.Name);
            _logger.LogInformation("JobId {jobId} updated by {userName}.", jobId, user.Identity.Name);

            await _targetUpdateRepository.UpdatePartially(targetDto);
        }