Esempio n. 1
0
        public async Task <IActionResult> FindOrderByAdminAsync([FromForm] SalesOrderParameters parameters)
        {
            var result = await _salesOrderService.FindAllSalesOrderAsync(parameters);

            if (!result.Succeed)
            {
                return(BadRequest(new ErrorResponse(HttpStatusCode.BadRequest, "Fail", result.Errors)));
            }

            var list = result.Value;

            if (list.TotalCount == 0)
            {
                return(NoContent());
            }

            Response.AddPagination(list.TotalCount, list.PageSize, list.CurrentPage, list.TotalPages, list.HasPrevious, list.HasNext);

            return(Ok(list));
        }