Esempio n. 1
0
        public ActionResult CreateOrUpdateForm(ProjectFormViewModel viewModel)
        {
            //if ProjectId is 0 means its new created project
            if (viewModel.Project.Id == 0)
            {
                Project project = new Project()
                {
                    Name  = viewModel.Project.Name,
                    Users = userHelper.GetAllUsersFromIds(viewModel.SelectedId),
                };

                projectHelper.AddProject(project);
            }
            //Else project need to update
            else
            {
                Project project = new Project()
                {
                    Id    = viewModel.Project.Id,
                    Name  = viewModel.Project.Name,
                    Users = userHelper.GetAllUsersFromIds(viewModel.SelectedId),
                };

                projectHelper.UpdateProject(project);
            }

            return(RedirectToAction("List"));
        }
Esempio n. 2
0
 public ActionResult Create(string name, string UserId)//userId is ProjectManager's Id
 {
     if (ProjectHelper.AddProject(name, UserId))
     {
         ViewBag.message = "Project created and Assigned successfully";
     }
     else
     {
         ViewBag.message = "Project creation unsuccessful";
     }
     return(RedirectToAction("Index"));
 }