示例#1
0
        public ApiResponseModel <List <Movies> > GetAll(string userToken)
        {
            ApiResponseModel <List <Movies> > result = new ApiResponseModel <List <Movies> >();

            using (HttpClient httpClient = new HttpClient())
            {
                httpClient.BaseAddress = new Uri(ConfigHelper.ApiUrl);
                httpClient.DefaultRequestHeaders.Accept.Clear();
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", userToken);
                var portalApiRequestModel = new GetAllRequestModel();
                portalApiRequestModel.UserToken = userToken;
                HttpResponseMessage response = httpClient.PostAsJsonAsync(string.Format("Movies/GetAll"), portalApiRequestModel).Result;
                result = response.Content.ReadAsAsync <ApiResponseModel <List <Movies> > >().Result;
            }
            return(result);
        }
示例#2
0
        public ApiResponseModel <List <UserWithDetail> > GetAll([FromBody] GetAllRequestModel requestModel)
        {
            var responseModel = new ApiResponseModel <List <UserWithDetail> >();

            try
            {
                responseModel.Data = _userService.GetAllWithDetail();

                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Success;
                responseModel.ResultStatusMessage = "Success";
            }
            catch (Exception ex)
            {
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Error;
                responseModel.ResultStatusMessage = ex.Message;
            }
            return(responseModel);
        }
        public ApiResponseModel <List <MoviesType> > GetAll([FromBody] GetAllRequestModel requestModel)
        {
            var responseModel = new ApiResponseModel <List <Data.Entity.MoviesType> >();

            try
            {
                responseModel.Data = _moviesTypeService.GetAll();

                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Success;
                responseModel.ResultStatusMessage = "Success";
            }
            catch (Exception ex)
            {
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Error;
                responseModel.ResultStatusMessage = ex.Message;
            }
            return(responseModel);
        }