public async Task <IActionResult> GetCatalogTypes(CatalogResourceParameters ctgResourcePrms) { var catalogs = await _catalogSvc.GetCatalogTypesAsync(ctgResourcePrms); if (catalogs is null) { _logger.LogInformation(Resource.NotFound); return(NotFound(ResponseError.Create(Resource.NotFound))); } var pagedList = catalogs.ToPagedList(ctgResourcePrms); var previousPageLink = pagedList.HasPrevious ? _linkHelper.GenerateLink(RESTAPI.Route.GET_GATALOGS, ctgResourcePrms, ResourceUriType.PreviousPage) : null; var nextPageLink = pagedList.HasNext ? _linkHelper.GenerateLink(RESTAPI.Route.GET_GATALOGS, ctgResourcePrms, ResourceUriType.NextPage) : null; var paginationMetadata = new { totalCount = pagedList.TotalCount, pageSize = pagedList.Pagesize, currentPage = pagedList.CurrentPage, totalPages = pagedList.TotalPages, previousPageLink, nextPageLink }; Response.Headers.Add("X-Pagination", JsonConvert.SerializeObject(paginationMetadata)); var responseObj = pagedList.ToViewModelList <CatalogType, CatalogTypeDto>(); return(Ok(ResponseSuccess.Create(responseObj))); }
public async Task <IActionResult> GetCatalogTypeByIdAsync(int id) { var catalog = await _catalogSvc.GetCatalogItemByIdAsync(id); if (catalog is null) { _logger.LogInformation(Resource.NotFound); return(NotFound(ResponseError.Create(Resource.NotFound))); } var responseObj = catalog.ToViewModel <CatalogType, CatalogTypeDto>(); return(Ok(ResponseSuccess.Create(responseObj))); }
//[Authorize] // [HttpGet("{email}/{password}")] public IActionResult CallBackReact(string email, string password) { return(Ok(ResponseSuccess.Create(email + "-" + password))); }