Example #1
0
 public CreateResultDTO Create(GroupEditDTO groupDTO, UserDTO userDTO)
 {
     using (var Data = DataFactory.Get())
     {
         var user = getUserService.Get(userDTO, Data);
         if (GroupRule.CanCreate(user))
         {
             var group = new Group();
             EditGroup(groupDTO, group);
             Data.GroupRepository.Add(group);
             Data.SaveChanges();
             return(new CreateResultDTO(group.Id, AccessCode.Succsess));
         }
     }
     return(CreateResultDTO.NoPremision);
 }
Example #2
0
 public ForumDTO Get(UserDTO userDTO)
 {
     using (var Data = DataFactory.Get()) {
         var user   = GetUserService.Get(userDTO, Data);
         var groups = new List <GroupPreviewDTO>();
         foreach (var Group in Data.GroupRepository.Get())
         {
             groups.Add(ForumDTOHelper.GetDTO(user, Group));
         }
         return(new ForumDTO {
             Groups = groups, CanCreateGroup = GroupRules.CanCreate(user)
         });
     }
 }