Пример #1
0
        public static Person Random(int id)
        {
            var ngen = Ngen.Value;
            var r = _random.Value;

            var person = new Person
            {
                Id = id,
                FirstName = ngen.GenerateNames(NameForms.First, false, 1).Single(),
                LastName = ngen.GenerateNames(NameForms.Last, false, 1).Single(),
                BirthDate = r.NextDateTime("1/1/1960", "12/31/1999"),
                Phone = r.NextPhone()
            };

            person.Email = string.Format("{0}{1}@{2}",
                                         person.FirstName[0],
                                         person.LastName,
                                         r.PickNext("gmail.com", "yahoo.com", "msn.com", "core-techs.net", "aol.com", "hotmail.com"))
                .ToLower();

            return person;
        }
 public ActionResult AddPerson(Person person)
 {
     _repo.Add(person);
     return GetPeople();
 }
 public void Add(Person person)
 {
     person.Id = _people.Max(x => x.Id) + 1;
     _people.Add(person);
 }