public Project(String name, String description, User creator, String creatorUserName) { this.Name = name; this.Description = description; this.Creator = creator; this.CreatorUserName = creatorUserName; this.Members = new HashSet<User>(); }
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 Register(RegisterModel model) { if (ModelState.IsValid) { try { var user = new User(); user.UserName = model.UserName; user.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(model.Password, "md5"); user.Email = model.Email; unitOfWork.UserRepository.Add(user); unitOfWork.Save(); FormsService.SignIn(model.UserName, false); return RedirectToAction("Index", "Home"); } catch (ConstraintException) { ModelState.AddModelError("UserName", "The UserName already exists."); } } ViewBag.PasswordLength = MembershipService.MinPasswordLength; return View(model); }
public Comment(User author, string text) { // If the text is less than 2 symbols long, the system throws an ArgumentException with an appropriate message. this.Author = author; this.Text = text; }