Example #1
0
        public SearchViewModel(IPageService pageService, IGuitarService guitarService)
        {
            _guitarService = guitarService ?? throw new ArgumentNullException(nameof(guitarService));
            _pageService   = pageService;
            SearchCommand  = new Command <string>((string queryText) => SearchGuitars(queryText));

            GetGuitars();
        }
        public GuitarsViewModel(IPageService pageService, IGuitarService guitarService)
        {
            _guitarService = guitarService ?? throw new ArgumentNullException(nameof(guitarService));
            _pageService   = pageService;
            Guitars        = new ObservableCollection <Guitar>();

            SelectedGuitarCommand = new Command(async() => await SelectGuitar());
            SearchCommand         = new Command <string>((string queryText) => SearchGuitars(queryText));
            TextChangedCommand    = new Command(() => TextChanged());

            GetGuitars();
        }
        private IGuitarService GuitarService; // =  new GuitarService();

        #endregion Fields

        #region Constructors

        //Agregando el Dependency Injection
        //--------------------------------------------------------
        public GuitarController(IGuitarService GuitarService)
        {
            this.GuitarService = GuitarService;
        }
        private IGuitarService GuitarService; //  = new GuitarService();

        #endregion Fields

        #region Constructors

        //Agregando el Dependency Injection
        //--------------------------------------------------------
        public ProjectController(IGuitarService GuitarService)
        {
            this.GuitarService = GuitarService;
        }
Example #5
0
 public IGuitar StandardTunning([FromServices] IGuitarService s, int fretCount) => s.StandardTuning(fretCount);
Example #6
0
 public IGuitar StandardTuning([FromServices] IGuitarService s) => s.StandardTuning();