コード例 #1
0
 public ContentPath Update(ContentPath contentPath)
 {
     var contPath = _context.ContentPaths.FirstOrDefault(cp => cp.Id == contentPath.Id);
     if (contPath == null) throw new ArgumentException();
     _context.Entry(contentPath).State = System.Data.Entity.EntityState.Modified;
     _context.SaveChanges();
     return contPath;
 }
コード例 #2
0
 public void AddToMoviesDirectories()
 {
     Console.WriteLine(@"Enter the path ID:");
     var path = Console.ReadLine();
     var contentPath = new ContentPath
     {
         ContentType = ContentType.Movies,
         Path = path
     };
     if (_contentPathsRepository.Query(x => x.Path == path).FirstOrDefault() != null)
     {
         Console.WriteLine(@"Path already exists!");
         return;
     }
     _contentPathsRepository.Create(contentPath);
     Console.WriteLine(@"Path added!");
 }
コード例 #3
0
 public ContentPath Delete(ContentPath contentPath)
 {
     var path = _context.ContentPaths.Remove(contentPath);
     _context.SaveChanges();
     return path;
 }
コード例 #4
0
 public ContentPath Create(ContentPath contentPath)
 {
     var path = _context.ContentPaths.Add(contentPath);
     _context.SaveChanges();
     return path;
 }