예제 #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"));
        }