コード例 #1
0
        public RootFolder Add(RootFolder rootFolder)
        {
            var all = All();

            if (String.IsNullOrWhiteSpace(rootFolder.Path) || !Path.IsPathRooted(rootFolder.Path))
            {
                throw new ArgumentException("Invalid path");
            }

            if (!_diskProvider.FolderExists(rootFolder.Path))
            {
                throw new DirectoryNotFoundException("Can't add root directory that doesn't exist.");
            }

            if (all.Exists(r => r.Path.PathEquals(rootFolder.Path)))
            {
                throw new InvalidOperationException("Recent directory already exists.");
            }

            if (!String.IsNullOrWhiteSpace(_configService.DownloadedEpisodesFolder) &&
                _configService.DownloadedEpisodesFolder.PathEquals(rootFolder.Path))
            {
                throw new InvalidOperationException("Drone Factory folder cannot be used.");
            }

            _rootFolderRepository.Insert(rootFolder);

            rootFolder.FreeSpace       = _diskProvider.GetAvailableSpace(rootFolder.Path);
            rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
            return(rootFolder);
        }
コード例 #2
0
 public void Build()
 {
     _bookRepository.Insert(new BookInSecondDbContext
     {
         Id   = _guidGenerator.Create(),
         Name = "TestBook1"
     });
 }
コード例 #3
0
 public void Build()
 {
     _bookRepository.Insert(
         new BookInSecondDbContext(
             _guidGenerator.Create(),
             "TestBook1"
             )
         );
 }
コード例 #4
0
        private void AddPeople()
        {
            var douglas = new Person(Guid.NewGuid(), "Douglas", 42);

            douglas.Phones.Add(new Phone(douglas.Id, "123456789"));
            douglas.Phones.Add(new Phone(douglas.Id, "123456780", PhoneType.Home));

            _personRepository.Insert(douglas);

            _personRepository.Insert(new Person(Guid.NewGuid(), "John-Deleted", 33)
            {
                IsDeleted = true
            });

            var tenant1Person1 = new Person(Guid.NewGuid(), TenantId1 + "-Person1", 42, TenantId1);
            var tenant1Person2 = new Person(Guid.NewGuid(), TenantId1 + "-Person2", 43, TenantId1);

            _personRepository.Insert(tenant1Person1);
            _personRepository.Insert(tenant1Person2);
        }
コード例 #5
0
ファイル: CSharpController.cs プロジェクト: anttieskola/ae
        public async Task <ActionResult> Create(Snipplet snipplet)
        {
            if (snipplet.Headline != null && snipplet.Content != null)
            {
                snipplet.Tags.Add(CsTag);
                _repo.Insert(snipplet);
                await _repo.CommitAsync();

                return(RedirectToAction("Index"));
            }
            return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
        }
コード例 #6
0
        public NamingConfig GetConfig()
        {
            var config = _repository.SingleOrDefault();

            if (config == null)
            {
                _repository.Insert(NamingConfig.Default);
                config = _repository.Single();
            }

            return(config);
        }