Ejemplo n.º 1
0
 public GroupUserPermissionModel AddUserToGroup(GroupUserPermissionModel groupUserPermission)
 {
     using (var dbContext = dbContextFactory.CreateDbContext())
     {
         var entity = mapper.GroupUserPermissionsModelToGroupUserPermissionsEntity(groupUserPermission);
         dbContext.GroupsUserPermissions.Add(entity);
         dbContext.SaveChanges();
         return(mapper.GroupUserPermissionsEntityToGroupUserPermissionsModel(entity));
     }
 }
        public void AddUserToGroupTest_NotNull()
        {
            var groupUserPermissionModel = new GroupUserPermissionModel()
            {
                Group  = fixture.groupModel,
                User   = fixture.userModel,
                Permit = Permission.MANAGE
            };
            var returnedGroupUserPermissionModel = fixture.Repository.AddUserToGroup(groupUserPermissionModel);

            Assert.NotNull(returnedGroupUserPermissionModel);
        }
Ejemplo n.º 3
0
 public GroupUserPermission GroupUserPermissionsModelToGroupUserPermissionsEntity(GroupUserPermissionModel model)
 {
     return(new GroupUserPermission
     {
         Id = model.Id,
         Group = GroupModelToGroupEntity(model.Group),
         User = UserModelToUserEntity(model.User),
         Permit = model.Permit
     });
 }