Ejemplo n.º 1
0
        public async Task <IActionResult> Get(int reportId)
        {
            var report = (await _reportsService.Get(new[] { reportId })).FirstOrDefault();

            if (report == null)
            {
                return(NotFound("Report"));
            }

            return(Ok(report));
        }
Ejemplo n.º 2
0
        // GET: PMS/Reports
        public ActionResult ReportsData(int?id)
        {
            List <FilterEntity> listFilters = _filterService.GetFilters();

            ViewBag.Filters = listFilters;
            tblReport data = null;

            if (id == null)
            {
                data = new tblReport();
            }
            else
            {
                data = _reportsService.Get(id.Value);
            }

            return(View(data));
        }
Ejemplo n.º 3
0
        private PagedResponse <Reports> GetPagedResponse(ReportsSearch obj)
        {
            var listaObjava = reportsService.Get(obj);
            PagedResponse <Reports> respons = new PagedResponse <Reports>();

            respons.TotalPageCount = (int)Math.Ceiling((double)listaObjava.Count() / (double)obj.Limit);
            respons.Stavke         = listaObjava.Skip((obj.Page - 1) * obj.Limit).Take(obj.Limit).ToList();

            ReportsSearch iducaKlon = obj.Clone() as ReportsSearch;

            iducaKlon.Page = (iducaKlon.Page + 1) > respons.TotalPageCount ? -1 : iducaKlon.Page + 1;
            String iduciUrl = iducaKlon.Page == -1 ? null : this.Url.Action("Get", null, iducaKlon, Request.Scheme);

            ReportsSearch proslaKlon = obj.Clone() as ReportsSearch;

            proslaKlon.Page = (proslaKlon.Page - 1) < 0 ? -1 : proslaKlon.Page - 1;
            String prosliUrl = proslaKlon.Page == -1 ? null : this.Url.Action("Get", null, proslaKlon, Request.Scheme);

            respons.IducaStranica  = !String.IsNullOrWhiteSpace(iduciUrl) ? new Uri(iduciUrl) : null;
            respons.ProslaStranica = !String.IsNullOrWhiteSpace(prosliUrl) ? new Uri(prosliUrl) : null;
            return(respons);
        }