public List <Task> GetTasks() { using (var context = new MaatAppDBContext()) { return(context.Task.ToList()); } }
public List <ComparisonResult> GetComparisonResults() { using (var context = new MaatAppDBContext()) { return(context.ComparisonResult.ToList()); } }
public Task GetTask(int id) { using (var context = new MaatAppDBContext()) { return(context.Task.Where(r => r.Id == id).FirstOrDefault()); } }
public List <ComparisonResult> GetComparisonResultsByTask(int taskID) { using (var context = new MaatAppDBContext()) { return(context.ComparisonResult.Where(r => r.TaskId == taskID).ToList()); } }
public List <FileEntry> GetFilesByTask(int taskID) { using (var context = new MaatAppDBContext()) { return(context.FileEntry.Where(r => r.TaskId == taskID).ToList()); } }
public List <FileEntry> GetFiles() { using (var context = new MaatAppDBContext()) { return(context.FileEntry.ToList()); } }
public FileEntry GetFile(int id) { using (var context = new MaatAppDBContext()) { return(context.FileEntry.Where(r => r.Id == id).FirstOrDefault()); } }
public void UpdateTask(Task task) { using (var context = new MaatAppDBContext()) { context.Update <Task>(task); context.SaveChanges(); } }
public void AddTask(Task task) { using (var context = new MaatAppDBContext()) { context.Add <Task>(task); context.SaveChanges(); } }
public void UpdateComparisonResult(ComparisonResult comparisonResult) { using (var context = new MaatAppDBContext()) { context.Update <ComparisonResult>(comparisonResult); context.SaveChanges(); } }
public void UpdateFile(FileEntry file) { using (var context = new MaatAppDBContext()) { context.Update <FileEntry>(file); context.SaveChanges(); } }
public ComparisonResult GetComparisonResult(int file1Id, int file2Id) { using (var context = new MaatAppDBContext()) { return(context.ComparisonResult .Where(r => r.File1Id == file1Id && r.File2Id == file2Id) .FirstOrDefault()); } }
public void DeleteTask(int id) { using (var context = new MaatAppDBContext()) { Task taskToDelete = context.Task.Where(r => r.Id == id).FirstOrDefault(); context.Remove <Task>(taskToDelete); context.SaveChanges(); } }
public void DeleteComparisonResult(int file1Id, int file2Id) { using (var context = new MaatAppDBContext()) { ComparisonResult comparisonResultToDelete = context.ComparisonResult .Where(r => r.File1Id == file1Id && r.File2Id == file2Id) .FirstOrDefault(); context.Remove <ComparisonResult>(comparisonResultToDelete); context.SaveChanges(); } }
public void DeleteFile(int id) { using (var context = new MaatAppDBContext()) { List <ComparisonResult> comparisonResults = context.ComparisonResult .Where(r => r.File1Id == id || r.File2Id == id) .ToList(); foreach (var res in comparisonResults) { context.Remove <ComparisonResult>(res); } FileEntry fileToDelete = context.FileEntry.Where(r => r.Id == id).FirstOrDefault(); context.Remove <FileEntry>(fileToDelete); context.SaveChanges(); } }