public static void FilledBy(this IList<ProjectAuthorizationModel> models, IList<Authorization> authorizations) { foreach (Authorization authorization in authorizations) { ProjectAuthorizationModel model = new ProjectAuthorizationModel(); model.FilledBy(authorization.Project); models.Add(model); } }
public IList<ProjectAuthorizationModel> GetAdmined(int userId) { IList<AuthorizationModel> auths = new List<AuthorizationModel> { new AuthorizationModel { CanAdmin=false, CanOwn=true, CanPublish=true, User=new UserModel{ Id=1, Name="心情"}, Id=3 }, new AuthorizationModel { CanAdmin=false, CanOwn=true, CanPublish=true, User=new UserModel{ Id=1, Name="自由飞"}, Id=4 } }; ProjectAuthorizationModel model1 = new ProjectAuthorizationModel { Id = 1, Name = "首顾科技", Authorizations = auths }; ProjectAuthorizationModel model2 = new ProjectAuthorizationModel { Id = 2, Name = "任务管理", Authorizations = auths }; IList<ProjectAuthorizationModel> models = new List<ProjectAuthorizationModel> { model1, model2 }; return models; }