コード例 #1
0
ファイル: RecordsController.cs プロジェクト: egibra/BCE
        public async Task <IActionResult> GetRecord(int id)
        {
            var record = await _repo.GetRecord(id);

            var recordToReturn = _mapper.Map <RecordToReturnDto>(record);

            return(Ok(record));
        }
コード例 #2
0
        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");
        }