public async Task <IActionResult> PutMETAssessment([FromRoute] Guid id, [FromBody] METAssessment mETAssessment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mETAssessment.Id) { return(BadRequest()); } _context.Entry(mETAssessment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!METAssessmentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostMETAssessment([FromBody] METAssessment mETAssessment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.METAssessments.Add(mETAssessment); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMETAssessment", new { id = mETAssessment.Id }, mETAssessment)); }
public void SeedMetAssessments() { DataTable table = _seedData.Tables["METAssessment"]; int rowcount = table.Rows.Count; for (int i = 0; i < rowcount; i++) { object[] columns = table.Rows[i].ItemArray; Guid CapabilityId = new Guid(columns[0].ToString()); METAssessment metAssessment = new METAssessment { CapabilityAssessmentId = new Guid(columns[0].ToString()), METAssessmentId = new Guid(columns[1].ToString()), Description = columns[2].ToString(), Abbreviation = columns[3].ToString(), Name = columns[4].ToString(), Status = columns[5].ToString(), Assessed = (DateTime)columns[6], Achieved = columns[7].ToString(), Current = columns[8].ToString(), Next = columns[9].ToString(), Personnel = Convert.ToInt32(columns[10]), Equipment = Convert.ToInt32(columns[11]), Supply = Convert.ToInt32(columns[12]), Training = Convert.ToInt32(columns[13]), Ordnance = Convert.ToInt32(columns[14]), Overall = Convert.ToInt32(columns[15]) }; _context.METAssessments.Add(metAssessment); } _context.SaveChanges(); }