Ejemplo n.º 1
0
        public async Task <IActionResult> GetAllAboutUs([FromQuery(Name = "pageNumber")] int PageNumber, [FromQuery(Name = "pageSize")] int PageSize)
        {
            try
            {
                if (PageNumber <= 0)
                {
                    return(StatusCode((int)System.Net.HttpStatusCode.BadRequest, "Page number not found!"));
                }
                else if (PageSize <= 0)
                {
                    return(StatusCode((int)System.Net.HttpStatusCode.BadRequest, "Page size not found!"));
                }
                else
                {
                    PagedList <AboutUsContentDTO> items = await _aboutUsRepo.GetAllAboutUs(PageNumber, PageSize);

                    if (items != null)
                    {
                        var result = new
                        {
                            items.TotalCount,
                            items.PageSize,
                            items.CurrentPage,
                            items.TotalPages,
                            items.HasNext,
                            items.HasPrevious,
                            items
                        };
                        return(Ok(result));
                    }
                    else
                    {
                        return(NoContent());
                    }
                }
            }
            catch (Exception ex)
            {
                return(StatusCode((int)System.Net.HttpStatusCode.InternalServerError, ex.Message));
            }
        }
        public IActionResult Index()
        {
            var AboutUs = _AboutUsRepository.GetAllAboutUs();

            return(View(AboutUs));
        }