public override void Save(Librarian item)
 {
     Librarian librarian = GetItem(item.Id);
     if (librarian == null)
     {
         context.Librarians.InsertOnSubmit(item);
     }
     else
     {
         librarian.FullName = item.FullName;
         librarian.Department = item.Department;
     }
     context.SubmitChanges();
 }
        public LibraryClassTest()
        {
            repository = new Repository(new MSSQLRepositoryFactory());

            reader = new Reader("First Reader", "Brest");
            repository.ReaderRepository.Save(reader);
            department = new LibraryDepartment("Abonement", true);
            repository.LibraryDepartmentRepository.Save(department);
            librarian = new Librarian("First Librarian ", department);
            repository.LibrarianRepository.Save(librarian);
            book = new Book("First Author", "Title", 2002, department);
            repository.BookRepository.Save(book);
            book2 = new Book("Second Author", "Title", 2000, department);
            repository.BookRepository.Save(book2);

            library = new LibraryClass(repository);
        }
		private void detach_Librarians(Librarian entity)
		{
			this.SendPropertyChanging();
			entity.Department = null;
		}
		partial void DeleteLibrarian(Librarian instance);
		partial void UpdateLibrarian(Librarian instance);
		partial void InsertLibrarian(Librarian instance);
 public override void Remove(Librarian item)
 {
     Remove(item.Id);
 }
 public LibrarianTest()
 {
     l1 = new Librarian("Name1", new LibraryDepartment("Абонемент", true));
     l2 = new Librarian("Name2", new LibraryDepartment("Читальный зал", false));
     l3 = new Librarian(l1.Id, l1.FullName, l1.Department);
 }