Beispiel #1
0
 public void Add(AccountInProjectEntity role)
 {
     throw new System.NotImplementedException();
 }
Beispiel #2
0
 public void Update(AccountInProjectEntity roleWithChanges)
 {
     throw new System.NotImplementedException();
 }
        public ActionResult EditProject(int id)
        {
            if (accountInProjectsRepository.GetById(id) != null)
            {
                AccountInProjectEntity      projectEntity       = this.accountInProjectsRepository.GetById(id);
                IEnumerable <AccountEntity> allAccountEntity    = this.accountsRepository.GetAll();
                IEnumerable <TaskEntity>    allTaskEntity       = this.tasksRepository.GetAll();
                IEnumerable <RoleEntity>    roleByProjectEntity = this.rolesRepository.GetAll();

                var model = new ManageProjectManagementModel
                {
                    Id          = projectEntity.Project.Id,
                    ProjectName = projectEntity.Project.Name,
                    Description = projectEntity.Project.Description,
                    Task        = allTaskEntity.Select(taskEntity => new TaskEntity
                    {
                        Id          = taskEntity.Id,
                        Title       = taskEntity.Title,
                        Description = taskEntity.Description,
                        Project     = taskEntity.Project
                    }),
                    TeamMember = allAccountEntity.Select(accountEntity => new AccountEntity
                    {
                        Id          = accountEntity.Id,
                        Name        = accountEntity.Name,
                        MiddleName  = accountEntity.MiddleName,
                        Surname     = accountEntity.Surname,
                        Email       = accountEntity.Email,
                        Login       = accountEntity.Login,
                        Password    = accountEntity.Password,
                        AccessLevel = accountEntity.AccessLevel
                    }),
                    Role = roleByProjectEntity.Select(roleEntity => new RoleEntity
                    {
                        Id   = roleEntity.Id,
                        Name = roleEntity.Name,
                    })
                };
                return(View("EditProject", model));
            }
            else
            { //если это новый ид (добавление нового проекта)
                AccountInProjectEntity      projectEntity       = this.accountInProjectsRepository.GetById(id);
                IEnumerable <AccountEntity> allAccountEntity    = this.accountsRepository.GetAll();
                IEnumerable <TaskEntity>    allTaskEntity       = this.tasksRepository.GetAll();
                IEnumerable <RoleEntity>    roleByProjectEntity = this.rolesRepository.GetAll();

                var newProjectModel = new ManageProjectManagementModel
                {
                    Id          = id,
                    ProjectName = "",
                    Description = "",
                    Task        = allTaskEntity.Select(taskEntity => new TaskEntity
                    {
                        Id          = taskEntity.Id,
                        Title       = taskEntity.Title,
                        Description = taskEntity.Description,
                        Project     = taskEntity.Project
                    }),
                    TeamMember = allAccountEntity.Select(accountEntity => new AccountEntity
                    {
                        Id          = accountEntity.Id,
                        Name        = accountEntity.Name,
                        MiddleName  = accountEntity.MiddleName,
                        Surname     = accountEntity.Surname,
                        Email       = accountEntity.Email,
                        Login       = accountEntity.Login,
                        Password    = accountEntity.Password,
                        AccessLevel = accountEntity.AccessLevel
                    }),
                    Role = roleByProjectEntity.Select(roleEntity => new RoleEntity
                    {
                        Id   = roleEntity.Id,
                        Name = roleEntity.Name,
                    })
                };
                return(View("EditProject", newProjectModel));
            }
        }