예제 #1
0
 public List <Task> GetTasks()
 {
     using (var context = new MaatAppDBContext())
     {
         return(context.Task.ToList());
     }
 }
예제 #2
0
 public List <ComparisonResult> GetComparisonResults()
 {
     using (var context = new MaatAppDBContext())
     {
         return(context.ComparisonResult.ToList());
     }
 }
예제 #3
0
 public Task GetTask(int id)
 {
     using (var context = new MaatAppDBContext())
     {
         return(context.Task.Where(r => r.Id == id).FirstOrDefault());
     }
 }
예제 #4
0
 public List <ComparisonResult> GetComparisonResultsByTask(int taskID)
 {
     using (var context = new MaatAppDBContext())
     {
         return(context.ComparisonResult.Where(r => r.TaskId == taskID).ToList());
     }
 }
예제 #5
0
 public List <FileEntry> GetFilesByTask(int taskID)
 {
     using (var context = new MaatAppDBContext())
     {
         return(context.FileEntry.Where(r => r.TaskId == taskID).ToList());
     }
 }
예제 #6
0
 public List <FileEntry> GetFiles()
 {
     using (var context = new MaatAppDBContext())
     {
         return(context.FileEntry.ToList());
     }
 }
예제 #7
0
 public FileEntry GetFile(int id)
 {
     using (var context = new MaatAppDBContext())
     {
         return(context.FileEntry.Where(r => r.Id == id).FirstOrDefault());
     }
 }
예제 #8
0
 public void UpdateTask(Task task)
 {
     using (var context = new MaatAppDBContext())
     {
         context.Update <Task>(task);
         context.SaveChanges();
     }
 }
예제 #9
0
 public void AddTask(Task task)
 {
     using (var context = new MaatAppDBContext())
     {
         context.Add <Task>(task);
         context.SaveChanges();
     }
 }
예제 #10
0
 public void UpdateComparisonResult(ComparisonResult comparisonResult)
 {
     using (var context = new MaatAppDBContext())
     {
         context.Update <ComparisonResult>(comparisonResult);
         context.SaveChanges();
     }
 }
예제 #11
0
 public void UpdateFile(FileEntry file)
 {
     using (var context = new MaatAppDBContext())
     {
         context.Update <FileEntry>(file);
         context.SaveChanges();
     }
 }
예제 #12
0
 public ComparisonResult GetComparisonResult(int file1Id, int file2Id)
 {
     using (var context = new MaatAppDBContext())
     {
         return(context.ComparisonResult
                .Where(r => r.File1Id == file1Id && r.File2Id == file2Id)
                .FirstOrDefault());
     }
 }
예제 #13
0
        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();
            }
        }
예제 #14
0
        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();
            }
        }
예제 #15
0
        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();
            }
        }