public async Task <IActionResult> GetRecord(int id) { var record = await _repo.GetRecord(id); var recordToReturn = _mapper.Map <RecordToReturnDto>(record); return(Ok(record)); }
public async Task <IActionResult> CreateComment(int recordID, Comment comment) { var record = _repo.GetRecord(recordID); if (record.Result == null) { return(BadRequest()); } comment.RecordID = recordID; comment.DateCreated = DateTime.Now; _repo.Add(comment); if (await _repo.SaveAll()) { return(Ok(record)); } throw new Exception("Creating the record failed on save"); }