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))))); }
public ActionResult <SituationDTO> PutSituation(int id, Situation situation) { if (id != situation.SituationId) { return(BadRequest()); } try { return(Ok(_mapper.Map <SituationDTO>(_service.RegisterOrUpdateSituation(situation)))); } catch (DbUpdateConcurrencyException) { if (!_service.SituationExists(id)) { return(NotFound()); } else { throw; } } }