Beispiel #1
0
        public async Task <IActionResult> GetMedicines(string name, string drug, string proportion, string presentation, string laboratory, string stock, string order, int?pageNumber, int?pageSize)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            PaginatedList <Medicine> medicines = await _medicineRepository.ListAsync(name, drug, proportion, presentation, laboratory, stock, order, pageNumber, pageSize);

            HttpContext.Response.Headers.Add("page", medicines.PageIndex.ToString());
            HttpContext.Response.Headers.Add("totalRecords", medicines.TotalRecords.ToString());
            return(Ok(medicines));
        }