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; }
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!"); }
public ContentPath Delete(ContentPath contentPath) { var path = _context.ContentPaths.Remove(contentPath); _context.SaveChanges(); return path; }
public ContentPath Create(ContentPath contentPath) { var path = _context.ContentPaths.Add(contentPath); _context.SaveChanges(); return path; }