Exemplo n.º 1
0
        public async Task <DatatablesPagedResults <ClientApi> > GetAsync(DataParameter param)
        {
            var spec   = new ClientApiSpecification();
            var source = await _repository.GetAllAsync(spec);

            return(await _repository.GetByPagingAsync(source, param.Start, param.Length));
        }
Exemplo n.º 2
0
        public async Task <IReadOnlyList <Select2Binding> > BindingSelect2Async()
        {
            var spec   = new ClientApiSpecification(true);
            var source = await _repository.GetAllAsync(spec);

            var result = source.Where(x => x.IsActive == true)
                         .Select(x => new Select2Binding
            {
                Id   = x.Id,
                Text = x.Name
            }).ToList();

            return(result);
        }
Exemplo n.º 3
0
        public async Task <JwtResponse> GenerateJwtAsync(string clientId, string clientSecret, string username)
        {
            var jwtResponse = new JwtResponse();
            var spec        = new ClientApiSpecification(clientId, clientSecret);
            var clientApi   = await _clientApiRepository.GetAsync(spec);

            if (clientApi != null)
            {
                jwtResponse = _jwt.GetJwt(clientApi, username);

                //update ClientApi
                clientApi.Token        = jwtResponse.Token;
                clientApi.ExpiredToken = jwtResponse.ValidTo;
                clientApi.ModifiedBy   = username;
                await _clientApiRepository.UpdateAsync(clientApi);
            }

            return(jwtResponse);
        }
Exemplo n.º 4
0
        public async Task <Select2Result> BindingSelect2Async(Guid id)
        {
            var spec = new ClientApiSpecification(true);
            var data = await _repository.GetAsync(id);

            var text = string.Empty;

            if (data != null)
            {
                text = data.Name;
            }

            var source = await _repository.GetAllAsync(spec);

            var result = source.Where(x => x.IsActive == true)
                         .Select(x => new Select2Binding
            {
                Id   = x.Id,
                Text = x.Name
            }).ToList();

            return(result.BindingSelect2Edit(id, text));
        }
Exemplo n.º 5
0
        public async Task <ClientApi> GetAsync(Guid id)
        {
            var spec = new ClientApiSpecification();

            return(await _repository.GetAsync(spec, id));
        }
Exemplo n.º 6
0
        public async Task <IReadOnlyList <ClientApi> > GetAllAsync()
        {
            var spec = new ClientApiSpecification();

            return(await _repository.GetAllAsync(spec));
        }
Exemplo n.º 7
0
        public async Task <DatatablesPagedResults <ClientApi> > DatatablesAsync(DatatablesParameter param)
        {
            var spec = new ClientApiSpecification();

            return(await _repository.DatatablesAsync(param, spec));
        }