public async Task <IActionResult> PutAssessmentComment([FromRoute] Guid id, [FromBody] AssessmentComment assessmentComment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != assessmentComment.Id) { return(BadRequest()); } _context.Entry(assessmentComment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssessmentCommentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostAssessmentComment([FromBody] AssessmentComment assessmentComment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.AssessmentComments.Add(assessmentComment); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAssessmentComment", new { id = assessmentComment.Id }, assessmentComment)); }
public AssessmentComment GetAssessmentComment(string assessmentCommentId) { DataTable assessmentComments = _seedData.Tables["AssessmentComments"]; AssessmentComment comment = null; DataRow row = assessmentComments.Select("Id = '" + assessmentCommentId + "'").FirstOrDefault <DataRow>(); if (row != null) { comment = new AssessmentComment() { Id = new Guid(row[0].ToString()), Personnel = row[1].ToString(), Equipment = row[2].ToString(), Supply = row[3].ToString(), Training = row[4].ToString(), Ordnance = row[5].ToString(), Facility = row[6].ToString(), Overall = row[7].ToString() }; } return(comment); }