Exemplo n.º 1
0
        public ActionResult Details(string id)
        {
            List <string> list = new List <string>();

            foreach (var x in ReportContentViewModel.EnumToList <ReportContentViewModel.ReportUser>())
            {
                list.Add(ReportContentViewModel.GetEnumDescription(x));
            }
            ViewBag.reportContentList = list;
            var allUser = Context.Users.Find(_ => true).ToList();

            if (allUser.Where(x => x.Id.Equals(id)).Any() == false)
            {
                ViewBag.errorMessage = "Không có kết quả!";
                return(View("NotFoundError"));
            }
            else
            {
                var user = Context.Users.Find(x => x.Id.Equals(new ObjectId(id))).FirstOrDefault();
                ViewBag.currentUser      = User.Identity.GetUserId();
                ViewBag.cloudinary       = cloudinary;
                ViewBag.allUser          = allUser;
                ViewBag.allBook          = Context.Books.Find(_ => true).ToList();
                ViewBag.allAuthor        = Context.Authors.Find(_ => true).ToList();
                ViewBag.listInteractBook = BooksControllerHelper.LastestBookInteracted(id);
                return(View(user));
            }
        }
Exemplo n.º 2
0
        private List <string> GroupReportContent()
        {
            List <string> list = new List <string>();

            foreach (var x in ReportContentViewModel.EnumToList <ReportContentViewModel.ReportGroup>())
            {
                list.Add(ReportContentViewModel.GetEnumDescription(x));
            }
            return(list);
        }
Exemplo n.º 3
0
 //
 // GET: /Reports/
 public ActionResult Index(int?page)
 {
     if (Context.Users.Find(x => x.Id.Equals(User.Identity.GetUserId())).FirstOrDefault().Roles.Contains("admin"))
     {
         ViewBag.allUser  = Context.Users.Find(_ => true).ToList();
         ViewBag.allGroup = Context.Groups.Find(_ => true).ToList();
         List <Report>          user       = Context.Reports.Find(x => x.ReportedUserId != null && x.Status.Equals(true)).ToList();
         List <Report>          group      = Context.Reports.Find(x => x.ReportedGroupId != null && x.Status.Equals(true)).ToList();
         int                    pageSize   = 6;
         int                    pageNumber = (page ?? 1);
         ReportContentViewModel report     = new ReportContentViewModel()
         {
             ListReportUser  = user.ToPagedList(pageNumber, pageSize),
             ListReportGroup = group.ToPagedList(pageNumber, pageSize)
         };
         return(View(report));
     }
     else
     {
         ViewBag.errorMessage = "Bạn không có quyền truy cập vào chức năng này";
         return(View("NotFoundError"));
     }
 }