コード例 #1
0
        //GET: Forum/ManageGroups
        public ActionResult ManageGroups(int?page, ForumMessageId?message)
        {
            ViewBag.StatusText = message == ForumMessageId.AddGroupSuccess ? "Group added successfully."
                : message == ForumMessageId.DeleteGroupSuccess ? "Group successfully deleted."
                : "";

            bool result = User.IsInRole("Doctor");

            if (!result)
            {
                ViewBag.Error = "Please sign into a doctoral account to manage groups";
                return(View("Error"));
            }

            var db     = new ApplicationDbContext();
            var groups = db.Groups.OrderBy(u => u.GroupName).ToList();

            var currentPage = page ?? 1;
            var model       = new ManageGroupsViewModel
            {
                Groups = groups.ToPagedList(currentPage, DefaultPageSize)
            };

            return(View(model));
        }
コード例 #2
0
 public ManageGroupsView(ManageGroupsViewModel vm)
     : base(vm)
 {
     InitializeComponent();
 }