public PagedResultModel <Client> Get(int pageIndex, int pageSize) { if (pageIndex < 0) { throw new ArgumentOutOfRangeException("pageIndex", "pageIndex no debe ser menor a cero."); } if (pageSize < 0) { throw new ArgumentOutOfRangeException("pageSize", "pageIndex no debe ser menor a cero."); } var totalItems = clientsRepository.TotalClients(); var totalPages = (long)Math.Floor((decimal)totalItems / pageSize); var items = clientsRepository.Get(pageIndex, pageSize); var result = new PagedResultModel <Client> { PageIndex = pageIndex, PageSize = pageSize, TotalPages = totalPages, TotalItems = totalItems, Items = items }; return(result); }
public async Task <IActionResult> GetClient(Guid id) { Client result = await _clientRepository.Get(id); if (result != null) { return(Ok(result)); } return(NotFound()); }
public Task <ClientsModel> GetAsync(int id) { var dal = _clientRepository.Get(id); if (dal == null) { return(Task.FromResult <ClientsModel>(null)); } else { ClientsModel model = AutoMapperGenericHelper <Clients, ClientsModel> .Convert(dal); return(Task.FromResult(model)); } }
public IEnumerable <Clients> Get() { return(_clientsRepository.Get()); }