public Assessmentsvc.Database.Entity.Task GetTask(Guid taskId) { DataTable tasks = _seedData.Tables["Tasks"]; Assessmentsvc.Database.Entity.Task task = null; DataRow row = tasks.Select("Id = '" + taskId.ToString() + "'").FirstOrDefault <DataRow>(); if (row != null) { task = new Assessmentsvc.Database.Entity.Task() { Id = new Guid(row[0].ToString()), Title = row[1].ToString(), Description = row[2].ToString(), Number = row[3].ToString() }; } return(task); }
public void SeedTaskTable() { DataTable table = _seedData.Tables["Tasks"]; int rowcount = table.Rows.Count; for (int i = 0; i < rowcount; i++) { object[] columns = table.Rows[i].ItemArray; Assessmentsvc.Database.Entity.Task task = new Assessmentsvc.Database.Entity.Task { Id = new Guid(columns[0].ToString()), Title = columns[1].ToString(), Description = columns[2].ToString(), Number = columns[3].ToString(), }; _context.Tasks.Add(task); } _context.SaveChanges(); }