Ejemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            if (IsAuth())
            {
                _apiConnection.AddHeader(new Dictionary <string, string>()
                {
                    { "Authorization", "bearer " + GetToken() }
                });
                var response = await _apiConnection.Get <BaseResponse <List <GetJobResponse> > >(baseUrl + "Job/GetAll");

                if (response.IsSuccess)
                {
                    if (response.Result.State == State.Success)
                    {
                        return(View(new BaseResponse <List <GetJobResponse> >()
                        {
                            Result = response.Result.Result
                        }));
                    }
                    else
                    {
                        return(View(new BaseResponse <List <GetJobResponse> >()
                        {
                            Message = response.Result.Message
                        }));
                    }
                }
                else
                {
                    return(View(new BaseResponse <List <GetJobResponse> >()
                    {
                        Message = response.ErrorMessage
                    }));
                }
            }
            else
            {
                return(View(new BaseResponse <List <GetJobResponse> >()));
            }
        }