public async Task <IActionResult> GetByCategoryId(Guid id, [FromQuery] UserParamsModel userParams) { var categories = await _service.GetBySubCategoryId(id, userParams); Response.AddPaginationHeader(categories.CurrentPage, userParams.PageSize, categories.TotalItems, categories.TotalPage); return(Ok(categories)); }
public async Task <IActionResult> GetAll([FromQuery] UserParamsModel userParams) { var entities = await _service.GetAll(userParams); Response.AddPaginationHeader(entities.CurrentPage, userParams.PageSize, entities.TotalItems, entities.TotalPage); return(Ok(entities)); }
public async Task <QueryResult <ToDoModel> > GetBySubCategoryId(Guid Id, UserParamsModel userParams) { var result = new QueryResult <ToDoModel>(); var entities = await _repo.GetBySubCategoryId(Id, _mapper.Map <UserParams>(userParams)); var fileModels = _mapper.Map <List <ToDo>, List <ToDoModel> >(entities.Items); result.Items = fileModels; result.TotalItems = entities.TotalItems; result.CurrentPage = entities.CurrentPage; result.TotalPage = entities.TotalPage; return(result); }
public async Task <QueryResult <ToDoModel> > GetAll(UserParamsModel userParams) { var result = new QueryResult <ToDoModel>(); var entities = await _repo.GetAll(_mapper.Map <UserParams>(userParams)); var models = _mapper.Map <List <ToDo>, List <ToDoModel> >(entities.Items); result.Items = models; result.TotalItems = entities.TotalItems; result.CurrentPage = entities.CurrentPage; result.TotalPage = entities.TotalPage; return(result); }
public async Task <QueryResult <LinkModel> > GetAll(UserParamsModel userParams) { var result = new QueryResult <LinkModel>(); var subCategories = await _repo.GetAll(_mapper.Map <UserParams>(userParams)); List <LinkModel> categoryModels = _mapper.Map <List <Link>, List <LinkModel> >(subCategories.Items); result.Items = categoryModels; result.TotalItems = subCategories.TotalItems; result.CurrentPage = subCategories.CurrentPage; result.TotalPage = subCategories.TotalPage; return(result); }