public void Populate() { var user = new User("Andrew", FormsAuthentication.HashPasswordForStoringInConfigFile("facebook", "md5"), "Andrew", "Jones", "*****@*****.**"); var project1 = new Project("Android", "A mobile operating system", user, user.UserName); var project2 = new Project("Dart", "A programming language", user, user.UserName); user.Projects.Add(project1); user.Projects.Add(project2); unitOfWork.UserRepository.Add(user); unitOfWork.Save(); }
public ActionResult AddProject(AddProjectViewModel p) { if (ModelState.IsValid) { var user = unitOfWork.UserRepository.GetByID(User.Identity.Name); var project = new Project(p.Name, p.Description, user, user.UserName); user.Projects.Add(project); unitOfWork.Save(); return RedirectToAction("Index"); } return View(p); }
public ProjectDetailsViewModel(Project project) { this.Project = project; }