private void CreateCollections() { if (!Directory.Exists(_collectionsPath)) { throw new DirectoryNotFoundException($"Collections directory \"{_collectionsPath}\" not found."); } var folderNames = Directory.EnumerateDirectories(_collectionsPath); foreach (var folderName in folderNames) { var configFilePath = Path.Combine(folderName, _collectionConfigName); if (File.Exists(configFilePath)) { // This is a virtual collection that has a configuration file var config = GetCollectionConfig(configFilePath); var tags = GetTagsFromSearch(config.TagSearch); var folderInfo = new DirectoryInfo(folderName); _collectionService.Add(folderInfo.Name, tags); } else { // This is a physical collection that has folders for the content } } }
public async Task <IActionResult> Add([FromBody] SavedRecipeModel model) { model.IdUser = Guid.Parse(_accessor.HttpContext.User.Claims.First(c => c.Type == "IdUser").Value); await _collectionService.Add(model); return(NoContent()); }
public async Task <IActionResult> SaveEntity(CollectionViewModel viewModel) { if (!ModelState.IsValid) { return(new BadRequestResult()); } if (viewModel.Id == 0) { await _collectionService.Add(viewModel); } else { await _collectionService.Update(viewModel); } return(new OkObjectResult(viewModel)); }
private void DoSave() { // do action if (!Validate()) { return; } var collectedItem = new CollectedItem() { Caption = Caption, ImagePath = GenerateImagePath(), Lat = Latitude, Lng = Longitude, LocationKnown = LocationKnown, Notes = Notes, WhenUtc = DateTime.UtcNow }; _collectionService.Add(collectedItem); Close(this); }