public ActionResult Create(ProjectViewModel projectViewModel) { var project = DbManager.GetProjectByProjectCode(projectViewModel.Project.ProjectCode); if (project != null) { ModelState.AddModelError("Project.ProjectCode", "Project code allready exists!"); } if (ModelState.IsValid) { //Getting values from text fields and adding them into DB DbManager.AddProject(projectViewModel.Project); return(RedirectToAction("Index")); } var rolesList = new List <String>(); rolesList.Add("Project Manager"); projectViewModel.UsersSelectList = DbManager.GetUsersSelectList(rolesList); return(View(projectViewModel)); }