Ejemplo n.º 1
0
        public IActionResult Post([FromBody] Phase phase)
        {
            if (!_accessService.AllowPostPhase(User, phase.EngagementId))
            {
                return(StatusCode(403));
            }

            var validationResult = _phaseValidator.Validate(phase);

            if (!validationResult.IsValid)
            {
                ModelState.AddValidationResult(validationResult);
                return(BadRequest(ModelState));
            }

            if (phase.Id > 0)
            {
                _phaseService.Update(phase);
            }
            else
            {
                _phaseService.Add(phase);
            }

            return(Ok(phase));
        }
 public BaseResponse <PhaseOutputDto> Update([FromBody] PhaseInputDto phaseInputDto)
 {
     return(_phaseService.Update(phaseInputDto));
 }