예제 #1
0
        private CheckpointDTO Update(CheckpointViewModel viewModel)
        {
            try
            {
                log.Debug(CheckpointViewModel.FormatCheckpointViewModel(viewModel));

                // get
                log.Debug("_checkpointService.GetCheckpoint - checkpointId: " + viewModel.CheckpointId + " ");

                var existingCheckpoint = _checkpointService.GetCheckpoint(viewModel.CheckpointId);

                log.Debug("_checkpointService.GetCheckpoint - " + CheckpointDTO.FormatCheckpointDTO(existingCheckpoint));

                if (existingCheckpoint != null)
                {
                    // copy values
                    viewModel.UpdateDTO(existingCheckpoint, null); //RequestContext.Principal.Identity.GetUserId());

                    // update
                    log.Debug("_checkpointService.UpdateCheckpoint - " + CheckpointDTO.FormatCheckpointDTO(existingCheckpoint));

                    _checkpointService.UpdateCheckpoint(existingCheckpoint);

                    log.Debug("result: 'success'");
                }
                else
                {
                    log.Error("existingCheckpoint: null, CheckpointId: " + viewModel.CheckpointId);
                }

                return(existingCheckpoint);
            }
            catch (Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
예제 #2
0
 public IActionResult UpdateCheckpoint(Checkpoint checkpoint)
 {
     return(Ok(_checkpointService.UpdateCheckpoint(checkpoint)));
 }