Example #1
0
        public ActionResult DeleteGroup(string id)
        {
            var group = groupsManager.GetById(id);

            var users = userManager.GetList().Where(x => x.GroupId == group.Id);

            foreach (var item in users)
            {
                item.GroupId = groupsManager.GetByName("Global").Id;
                if (item.Role == Roles.Praepostor)
                {
                    item.Role = Roles.User;
                }
                userManager.Update(item);
            }

            foreach (var item in newsManager.GetList())
            {
                if (item.GroupId == group.Id)
                {
                    newsManager.Delete(item);
                }
            }

            groupsManager.Delete(group);

            return(RedirectToRoute("GetGroups"));
        }
 public NewsListPageView()
     : base()
 {
     newsManager = Resolver.GetInstance <INewsManager>();
     News        = new List <NewsItemViewModel>();
     News.AddRange(newsManager.GetList("PostingDate").Select(x => Mapper.Map <NewsItemViewModel, NewsItem>(x)));
 }
Example #3
0
 public NewsListPageView()
     : base()
 {
     newsManager = Resolver.GetInstance<INewsManager>();
     News = new List<NewsItemViewModel>();
     News.AddRange(newsManager.GetList("PostingDate").Select(x => Mapper.Map<NewsItemViewModel, NewsItem>(x)));
 }