public Domain.Response GetDomainObject()
        {
            Domain.Response dto = new Domain.Response();
            dto.ID = this.ResponseID;
            dto.QuestionID = this.QuestionID;
            dto.EvaluationID = this.EvaluationID;
            dto.DimensionID = this.DimensionID;
            dto.SelectedValue = (ResponseEnum)this.SelectedValue;
            dto.Name = this.Name;
            dto.DateCreated = this.DateCreated;
            dto.DateModified = this.DateModified;

            return dto;
        }
示例#2
0
        public async void LoadContent(bool book = false, string keyword = null)
        {
            this.IsRefreshing = true;

            var connection = await this.apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                this.IsRefreshing = false;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    connection.Message,
                    Languages.Accept);

                return;
            }

            var parameters = "";

            Domain.Response response = null;
            bool            isSearch = false;

            if (!book && keyword == null)
            {
                parameters = string.Format(
                    "?bible={0}&reference={1}",
                    MainViewModel.GetInstance().SelectedModule,
                    this.book.Shortname);
                response = await this.apiService.Get <ContentResponse>(
                    "http://api.biblesupersearch.com",
                    "/api",
                    parameters);
            }
            else if (!book)
            {
                parameters = string.Format(
                    "?bible={0}&search={1}",
                    MainViewModel.GetInstance().SelectedModule,
                    keyword);
                response = await this.apiService.Get <SearchResponse>(
                    "http://api.biblesupersearch.com",
                    "/api",
                    parameters);

                isSearch = true;
            }
            else
            {
                parameters = string.Format(
                    "?bible={0}&reference={1}&search={2}",
                    MainViewModel.GetInstance().SelectedModule,
                    this.book.Shortname,
                    keyword);
                response = await this.apiService.Get <SearchResponse>(
                    "http://api.biblesupersearch.com",
                    "/api",
                    parameters);

                isSearch = true;
            }


            if (!response.IsSuccess)
            {
                this.IsRefreshing = false;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    response.Message,
                    Languages.Accept);

                return;
            }


            if (!isSearch)
            {
                HandleBook(response);
            }
            else
            {
                HandleSearch(response);
            }
        }