Exemplo n.º 1
0
        private CheckpointDTO Create(CheckpointViewModel viewModel)
        {
            try
            {
                log.Debug(CheckpointViewModel.FormatCheckpointViewModel(viewModel));

                CheckpointDTO checkpoint = new CheckpointDTO();

                // copy values
                viewModel.UpdateDTO(checkpoint, null); //RequestContext.Principal.Identity.GetUserId());

                // audit
                checkpoint.CreateBy = null; //RequestContext.Principal.Identity.GetUserId();
                checkpoint.CreateOn = DateTime.UtcNow;

                // add
                log.Debug("_checkpointService.AddCheckpoint - " + CheckpointDTO.FormatCheckpointDTO(checkpoint));

                int id = _checkpointService.AddCheckpoint(checkpoint);

                checkpoint.CheckpointId = id;

                log.Debug("result: 'success', id: " + id);

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

                throw;
            }
        }
Exemplo n.º 2
0
 public IActionResult AddCheckpoint(Checkpoint checkpoint)
 {
     return(Ok(_checkpointService.AddCheckpoint(checkpoint)));
 }