Пример #1
0
        public ActionResult Activate(int projectId)
        {
            Projects project = projectRepository.Projects.FirstOrDefault(p => p.Id == projectId);

            if (ModelState.IsValid && project != null)
            {
                projectRepository.Activate(project);
            }
            return(RedirectToAction("AllProjects"));
        }
Пример #2
0
        public async Task <Project> CreateNewProject(long userId, Project project)
        {
            var addedItem = _projectRepository.Add(project);
            await _unitOfWork.Complete();

            var userProject = new UserProject
            {
                UserId    = userId,
                ProjectId = project.Id,
                Active    = false,
                RoleId    = 1
            };
            await _projectRepository.AddUserProject(userProject);

            await _unitOfWork.Complete();

            await _projectRepository.Activate(addedItem.Id, userId);

            await _unitOfWork.Complete();

            return(project);
        }