Пример #1
0
        public string GetChangeList(int fileId, int?count, int?page)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return("null");
            }

            int cnt, pg;

            if (!count.HasValue || !page.HasValue)
            {
                cnt = 10;
                pg  = 1;
            }
            else
            {
                cnt = count.Value;
                pg  = page.Value;
            }

            List <Changes> result;

            if (User.IsInRole("Admin"))
            {
                result = _context.GetAdminChangeList(fileId, cnt, pg);
            }
            else
            {
                result = _context.GetUserChangeList(fileId, User.Identity.Name, cnt, pg);
            }

            if (result.Count == 0)
            {
                return("null");
            }
            else
            {
                result.ForEach(res => res.File = null);

                return(JsonConvert.SerializeObject(result, JsonSettings));
            }
        }