public ItemAddViewModel(INavigationService navigationService, IToDoItemRepository toDoItemsRepository)
        {
            _navigationService   = navigationService;
            _toDoItemsRepository = toDoItemsRepository;

            SaveItemCommand = new DelegateCommand(OnSaveItem);
        }
Example #2
0
        /// <summary>
        ///     Seed sample data in the Todo container
        /// </summary>
        /// <param name="builder"></param>
        /// <returns></returns>
        public static async Task SeedToDoContainerIfEmptyAsync(this IApplicationBuilder builder)
        {
            using (IServiceScope serviceScope = builder.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                IToDoItemRepository _repo = serviceScope.ServiceProvider.GetService <IToDoItemRepository>();

                // Check if empty
                string sqlQueryText          = "SELECT * FROM c";
                IEnumerable <ToDoItem> todos = await _repo.GetItemsAsync(sqlQueryText);

                if (todos.Count() == 0)
                {
                    for (int i = 0; i < 100; i++)
                    {
                        ToDoItem beer = new ToDoItem()
                        {
                            Category = "Grocery",
                            Title    = $"Get {i} beers"
                        };

                        await _repo.AddItemAsync(beer);
                    }
                }
            }
        }
 public ToDoItemsController(
     IToDoItemRepository toDoItemRepository,
     IMapper mapper)
 {
     _mapper          = mapper;
     _ToDoItemService = toDoItemRepository;
 }
Example #4
0
        public ToDoItemListViewModel(IToDoItemRepository _toDoItemRepository, IDialogService _dialogService)
        {
            repository    = _toDoItemRepository;
            dialogService = _dialogService;
            ToDoItems     = new ObservableCollection <ToDoItem>(repository.GetToDoItems());

            AddCommand = new DelegateCommand(Add, CanAdd);
        }
        public MainPageViewModel(INavigationService navigationService, IToDoItemRepository toDoItemsRepository)

        {
            _navigationService   = navigationService;
            _toDoItemsRepository = toDoItemsRepository;

            RefreshListViewCommand = new DelegateCommand(OnListViewRefreshing);
        }
 /// <summary>
 ///     Ctor
 /// </summary>
 /// <param name="repo"></param>
 /// <param name="mapper"></param>
 /// <param name="cachedToDoItemsService"></param>
 public QueryHandler(IToDoItemRepository repo,
                     IMapper mapper,
                     ICachedToDoItemsService cachedToDoItemsService)
 {
     this._repo   = repo ?? throw new ArgumentNullException(nameof(repo));
     this._mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
     this._cachedToDoItemsService = cachedToDoItemsService ?? throw new ArgumentNullException(nameof(cachedToDoItemsService));
 }
Example #7
0
 public StarterFunction(ILogger <StarterFunction> log,
                        IEmailService emailService,
                        IToDoItemRepository repo)
 {
     this._log          = log ?? throw new ArgumentNullException(nameof(log));
     this._emailService = emailService ?? throw new ArgumentNullException(nameof(emailService));
     this._repo         = repo ?? throw new ArgumentNullException(nameof(repo));
 }
Example #8
0
 public ToDoItemCompletedDomainEventHandler(
     IToDoItemRepository todoRepository,
     ILoggerFactory logger,
     IAppIntegrationEventService appIntegrationEventService)
 {
     _todoRepository             = todoRepository ?? throw new ArgumentNullException(nameof(todoRepository));
     _logger                     = logger ?? throw new ArgumentNullException(nameof(logger));
     _appIntegrationEventService = appIntegrationEventService;
 }
 public ToDoItemsListViewModel(IToDoItemRepository repository)
 {
     if (repository == null)
     {
         throw new ArgumentNullException("repository must not be null");
     }
     this._repository = repository;
     this.LoadIncomplete();
 }
        public ToDoItemEditViewModel(IToDoItemRepository repository, int id)
            : this(repository)
        {
            if (id <= 0)
            {
                throw new ArgumentException("id must be greater than 0!");
            }

            this.Load(id);
        }
            /// <summary>
            ///     Validator ctor
            /// </summary>
            public CreateToDoItemCommandValidator(IToDoItemRepository repo)
            {
                this._repo = repo ?? throw new ArgumentNullException(nameof(repo));

                RuleFor(x => x.Category)
                .NotEmpty();
                RuleFor(x => x.Title)
                .NotEmpty()
                .MustAsync(HasUniqueTitle).WithMessage("Title must be unique");
            }
        public ToDoItemDetailsViewModel(IToDoItemRepository repository)
        {
            if (repository == null)
            {
                throw new ArgumentNullException("repository must not be null");
            }

            this._repository = repository;

            this.ToDoItem = new ToDoItem();
        }
Example #13
0
        public ToDoItemTest()
        {
            var options = new DbContextOptionsBuilder <ToDoContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;
            var dbContext = new ToDoContext(options);

            _toDoListRepository = new ToDoListRepository(dbContext);
            _toDoItemRepository = new ToDoItemRepository(dbContext);
            _unitOfWork         = new UnitOfWork(dbContext);
        }
Example #14
0
        public ToDoItemListPageViewModel(INavigationService navigationService, IToDoItemRepository toDoItemsRepository)
        {
            _navigationService   = navigationService;
            _toDoItemsRepository = toDoItemsRepository;

            AddToDoItemCommand     = new DelegateCommand(OnAddItem);
            ChangeStateCommand     = new DelegateCommand <ToDoItem>(OnChangeState);
            EditItemCommand        = new DelegateCommand(OnEditItem);
            DeleteCommand          = new DelegateCommand <ToDoItem>(OnDeleteItem);
            RefreshListViewCommand = new DelegateCommand(OnListViewRefreshing);
            GoToAppSettingsCommand = new DelegateCommand(OnGoinngToAppSettings);
        }
        public ToDoViewPresenter(ITodoView view, IToDoItemRepository repository, IActionExecutor actionExecutor, IMessageBoxPresenter messageBoxPresenter)
        {
            _view                = view ?? throw new ArgumentNullException(nameof(view));
            _repository          = repository ?? throw new ArgumentNullException(nameof(repository));
            _actionExecutor      = actionExecutor ?? throw new ArgumentNullException(nameof(actionExecutor));
            _messageBoxPresenter = messageBoxPresenter ?? throw new ArgumentNullException(nameof(messageBoxPresenter));

            view.CloseButtonClick += view.Dispose;
            view.AddButtonClick   += OnAddButtonClick;
            view.ToDoItemChecked  += OnChangeItemChecked;
            view.Loaded           += OnLoaded;
        }
Example #16
0
 public ToDoItemController(IUnitOfWork unitOfWork,
                           IToDoListRepository toDoListRepository,
                           IToDoItemRepository toDoItemRepository,
                           IMapper mapper,
                           IOperatorUser operatorUser)
 {
     _unitOfWork         = unitOfWork;
     _toDoListRepository = toDoListRepository;
     _toDoItemRepository = toDoItemRepository;
     _mapper             = mapper;
     _operatorUser       = operatorUser;
 }
Example #17
0
            /// <summary>
            ///     Validator ctor
            /// </summary>
            public UpdateToDoItemCommandValidator(IToDoItemRepository repo)
            {
                this._repo = repo ?? throw new ArgumentNullException(nameof(repo));

                RuleFor(x => x.Id)
                .NotEmpty();

                RuleFor(x => x.Category)
                .NotEmpty();

                RuleFor(x => x.Title)
                .NotEmpty();
            }
        public ToDoItemEditViewModel(IToDoItemRepository repository)
        {
            if (repository == null)
            {
                throw new ArgumentNullException("repository must not be null");
            }

            this._repository = repository;

            this.ToDoItem = new ToDoItem()
                            {
                                    IsCompleted = false,
                                    ReminderIsEnabled = true,
                            };
        }
Example #19
0
 public MyListController(
     UserManager <ApplicationUser> userManager,
     IToDoItemRepository toDoItemRepository,
     ICategoryRepository categoryRepository,
     ILoggerFactory loggerFactory,
     IMemoryCache memoryCache,
     TempFavoritesService favoritesService)
 {
     this._userManager        = userManager;
     this._toDoItemRepository = toDoItemRepository;
     this._categoryRepository = categoryRepository;
     this._logger             = loggerFactory.CreateLogger <MyListController>();
     this._cache            = memoryCache;
     this._favoritesService = favoritesService;
 }
Example #20
0
        public ToDoItemBpc(IRepositoryFactory repositoryFactory, ILoggerFactory loggerFactory)
        {
            if (repositoryFactory == null)
            {
                throw new ArgumentNullException(nameof(repositoryFactory));
            }
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _logger = loggerFactory.CreateLogger(nameof(ToDoItemBpc));

            _repositoryFactory  = repositoryFactory;
            _toDoItemRepository = _repositoryFactory.CreateTodoItemRepository();
        }
Example #21
0
        public ToDoItemPageViewModel(INavigationService navigationService, IItemAnnouncementService itemAnnouncementService,
                                     IToDoItemRepository toDoItemsRepository, IVoiceRecognitionService voiceRecognitionService)
        {
            _navigationService       = navigationService;
            _itemAnnouncementService = itemAnnouncementService;
            _voiceRecognitionService = voiceRecognitionService;

            _toDoItemsRepository = toDoItemsRepository;

            SaveItemCommand      = new DelegateCommand(OnSaveItem);
            DeleteItemCommand    = new DelegateCommand(OnDeleteItem);
            GoBackCommand        = new DelegateCommand(OnGoBack);
            SpeakCommand         = new DelegateCommand(OnSpeak);
            SpeechToTitleCommand = new DelegateCommand(OnSpeechToTitle);
            SpeechToNotesCommand = new DelegateCommand(OnSpeechToNotes);
        }
Example #22
0
 public StatisticsService(IToDoItemRepository toDoItemRepository)
 {
     _toDoItemRepository = toDoItemRepository;
 }
 public ToDoController(IToDoItemRepository toDoItemRepository)
 {
     _toDoItemRepository = toDoItemRepository;
 }
Example #24
0
 public AddToDoItemCommandHandler(IToDoItemRepository repository)
 {
     _repository = repository;
 }
 public GetOneToDoItemRequestHandler(IToDoItemRepository repo)
 {
     _repo = repo;
 }
Example #26
0
 public ToDoController(IToDoItemRepository toDoItemRepository)
 {
     _todoItemRepository = toDoItemRepository;
 }
Example #27
0
 public ToDoItemController(IToDoItemRepository taskRepository)
 {
     _taskRepository = taskRepository;
 }
Example #28
0
 public UpdateToDoItemStatusCommandHandler(IToDoItemRepository toDoItemRepository, ILogger <UpdateToDoItemStatusCommandHandler> logger) : base(toDoItemRepository, logger)
 {
 }
Example #29
0
 public HomeController(IToDoItemRepository toDoItemRepository, IStudentRepository studentRepository, IUnitOfWork unitOfWorkRepository)
 {
     _toDoItemRepository   = toDoItemRepository;
     _studentRepository    = studentRepository;
     _unitOfWorkRepository = unitOfWorkRepository;
 }
 public MarkItemCompleteCommandHandler(IToDoItemRepository repository)
 {
     _repository = repository;
 }
 /// <summary>
 ///     Ctor
 /// </summary>
 /// <param name="repo"></param>
 /// <param name="mapper"></param>
 public CommandHandler(IToDoItemRepository repo,
                       IMapper mapper)
 {
     this._repo   = repo ?? throw new ArgumentNullException(nameof(repo));
     this._mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Example #32
0
 public ToDoItemsController(IToDoItemRepository toDoItemsRepository)
 {
     _repository = toDoItemsRepository;
 }
Example #33
0
 public DeleteToDoItemCommandHandler(IToDoItemRepository toDoItemRepository, ILogger <DeleteToDoItemCommandHandler> logger) : base(toDoItemRepository, logger)
 {
 }
Example #34
0
 public ToDoItemService(IToDoItemRepository toDoItemRepository)
 {
     _toDoItemRepository = toDoItemRepository;
 }
Example #35
0
 public CreateToDoItemCommandHandler(IToDoItemRepository toDoItemRepository, IRepository <ToDoList> toDoListepository, ILogger <CreateToDoItemCommandHandler> logger)
     : base(toDoItemRepository, logger)
 {
     _toDoListRepository = toDoListepository;
 }
 public StatasticsService(IToDoItemRepository toDoItemRepository)
 {
     _todoItemRepository = toDoItemRepository;
 }