public async Task <IActionResult> Post([FromBody] StudyNoIdDTO study) { if (!ModelState.IsValid) { _log.LogWarning("ModelState not valid. Return BadRequest"); return(BadRequest(ModelState)); } var id = await _repository.CreateAsync(study); return(CreatedAtAction(nameof(Get), new { id }, null)); }
public async Task <IActionResult> Post([FromBody] StudyDTO study) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var id = await _repository.CreateAsync(study); study.Id = id; return(CreatedAtAction("Get", new { id }, study)); }