public TodoItem(string richDescription, ICategoryResolverService categoryResolverService) : this() { string[] words = richDescription.Split(' '); for (var i = 0; i < words.Length; i++) { var word = words[i]; if (word.StartsWith("!") && this.Priority == null) // !3 => priority: 3 { int val; if (int.TryParse(word.Substring(1), out val)) { Priority = val; words[i] = null; } } else if (word.StartsWith("#") && this.Category == null) // #home => Category: home { Category = categoryResolverService.FindOrCreateCategory(word.Substring(1)); words[i] = null; } } var notParsed = words.Where(w => w != null); Description = string.Join(" ", notParsed.ToArray()); }
public ProductProcessorService(IBarcodeSearcherService barcodeService, IProductService productDataService, ICategoryResolverService categoryResolver) { this.barcodeSearcherService = barcodeService; this.productDataService = productDataService; this.categoryResolver = categoryResolver; }
public SharpTodoService(ITodoItemRepository todoItemRepository, ICategoryRepository categoryRepository, ICategoryResolverService categoryResolverService) { _todoItemRepository = todoItemRepository; _categoryRepository = categoryRepository; _categoryResolverService = categoryResolverService; }