Beispiel #1
0
        public ActionResult <LogErrorOccurrence> DeleteErrorOccurrence([FromBody] LogErrorOccurrenceDTO value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (_service.ConsultErrorOccurrenceById(value.ErrorId) == null)
            {
                return(BadRequest("400 BadRequest: ErrorOccurence does not exists."));
            }

            return(Ok(_mapper.Map <LogErrorOccurrenceDTO>(_service.DeleteErrorOccurrence(_mapper.Map <LogErrorOccurrence>(value)))));
        }
Beispiel #2
0
        public ActionResult <LogErrorOccurrence> PostErrorOccurrence([FromBody] LogErrorOccurrenceDTO value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            /*  if (!_userService.UserExists(value.UserId))
             *    return BadRequest("400 BadRequest: User does not exists.");*/

            if (!_situationService.SituationExists(value.SituationId))
            {
                return(BadRequest("400 BadRequest: Situation does not exists."));
            }

            return(Ok(_mapper.Map <LogErrorOccurrenceDTO>(_service.RegisterOrUpdateErrorOccurrence(_mapper.Map <LogErrorOccurrence>(value)))));
        }