Пример #1
0
        public MainPageViewModel(IHelloService helloService, CatFactApi catFactApi)
        {
            _helloService = helloService;
            _catFactApi   = catFactApi;
            _text         = _helloService.GetMessage();

            ButtonAction = new Command(execute: async() =>
            {
                IsBusy   = true;
                var fact = await _catFactApi.GetRandomCatFact();

                if (fact.Successful.success)
                {
                    Text = fact.Successful.Value.Text;
                }
                else
                {
                    var error = fact.Error.error;
                }
                IsBusy = false;
            }, canExecute: () => !IsBusy);
        }
Пример #2
0
        //
        // GET: /Messaging/Home/

        public ActionResult Index()
        {
            var model = _service.GetMessage();

            return(View((object)model));
        }