public IActionResult Post(int participantId, [FromBody] Notice notice) { var participant = _dbContext.Participants.FirstOrDefault(p => p.Id == participantId); if (participant == null) { return(NotFound()); } participant.Notices.Add(notice); _dbContext.SaveChanges(); return(NoContent()); }
public IActionResult Post([FromBody] Participant participant) { //participants. //participants.Add(participant); if (participant == null) { return(BadRequest()); } _dbContext.Participants.Add(participant); _dbContext.SaveChanges(); return(new NoContentResult()); }