当前位置: 首页>>代码示例>>C#>>正文


C# Models.Person类代码示例

本文整理汇总了C#中Models.Person的典型用法代码示例。如果您正苦于以下问题:C# Person类的具体用法?C# Person怎么用?C# Person使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Person类属于Models命名空间,在下文中一共展示了Person类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Register_VolunteerAlreadyExists

        public void Register_VolunteerAlreadyExists()
        {
            Person moqPerson = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "[email protected]",
                PhoneNumber = "555-222-9139"
            };

            List<Person> people = new List<Person>();
            people.Add(moqPerson);

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());

            VolunteerService service = new VolunteerService(moqDataService.Object);
            Person actual = service.Register("Cathy", "Jones", "[email protected]", "555-222-9139 ext 33", 6);

            Assert.AreEqual("Cathy", actual.FirstName);
            Assert.AreEqual("Jones", actual.LastName);
            Assert.AreEqual("[email protected]", actual.Email);
            Assert.AreEqual("555-222-9139 ext 33", actual.PhoneNumber);
        }
开发者ID:dayewah,项目名称:crisischeckin,代码行数:26,代码来源:VolunteerServiceTest.cs

示例2: Index

		public async Task<ActionResult> Index()
		{
			var person = new Person
			{
				Id = "1",
				Firstname = "Martijn",
				Lastname = "Laarman"
			};

			_client.Index(person);
			_client.IndexMany(new List<Person> { person, person, person });
			_client.Get<Person>("1");
			_client.DeleteIndex("not-existing-index");
			_client.ClusterHealth();

			using (MiniProfiler.StepStatic("Async"))
			{
				await _client.IndexAsync(person);
				using (MiniProfiler.StepStatic("Async inner 1"))
				{
					await _client.IndexAsync(new List<Person> { person, person, person });
				}
				using (MiniProfiler.StepStatic("Async inner 2"))
				{
					await _client.IndexManyAsync(new List<Person> { person, person, person });
					await _client.GetAsync<Person>("1");
				}
			}

			return View();
		}
开发者ID:bigerock,项目名称:MiniProfiler.Elasticsearch,代码行数:31,代码来源:HomeController.cs

示例3: Register_ValidVolunteer

        public void Register_ValidVolunteer()
        {
            Person moqPerson = new Person()
            {
                Id = 1,
                UserId = null,
                FirstName = "Bob",
                LastName = "Jones",
                Email = "[email protected]",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            };

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.AddPerson(It.IsAny<Person>())).Returns(moqPerson);

            VolunteerService service = new VolunteerService(moqDataService.Object);
            Person actual = service.Register("Bob", "Jones", "[email protected]", "555-222-9139", 1, 5);

            Assert.AreEqual(1, actual.Id);
            Assert.AreEqual("Bob", actual.FirstName);
            Assert.AreEqual("Jones", actual.LastName);
            Assert.AreEqual("[email protected]", actual.Email);
            Assert.AreEqual("555-222-9139", actual.PhoneNumber);
            Assert.AreEqual(1, actual.ClusterId);
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:26,代码来源:VolunteerServiceTest.cs

示例4: GetPersonDetailsForChangeContactInfoThrowsExpectedPersonNotFoundException

        public void GetPersonDetailsForChangeContactInfoThrowsExpectedPersonNotFoundException()
        {
            var personOne = new Person
            {
                Id = 1,
                UserId = 6,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "[email protected]",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            };

            var personTwo = new Person
            {
                Id = 2,
                UserId = 7,
                FirstName = "Stan",
                LastName = "Smith",
                Email = "[email protected]",
                PhoneNumber = "111-333-2222"
            };

            var dataService = new Mock<IDataService>();
            var personList = new List<Person>
            {
                personOne,
                personTwo
            };
            dataService.Setup(x => x.Persons).Returns(personList.AsQueryable());
            var underTest = new VolunteerService(dataService.Object);

            var result = underTest.GetPersonDetailsForChangeContactInfo(8);
        }
开发者ID:vkarosas,项目名称:crisischeckin,代码行数:34,代码来源:VolunteerServiceTest.cs

示例5: About

        public ActionResult About()
        {
            var person = new Person {FirstName = "Rob", LastName = "Gray"};
            _personRepository.Save(person);

            return View();
        }
开发者ID:robgray,项目名称:NHibernateFacilityMVC4Test,代码行数:7,代码来源:HomeController.cs

示例6: Delete

        public ActionResult Delete(Person person)
        {
            if (person != null) {
                personList.Remove(person);
            }

            return RedirectToAction("index");
        }
开发者ID:lozanotek,项目名称:advancedmvc,代码行数:8,代码来源:PersonController.cs

示例7: Create

        public ActionResult Create(Person person)
        {
            if (person != null) {
                person.Id = Guid.NewGuid();
                personList.Add(person);
            }

            return RedirectToAction("index");
        }
开发者ID:lozanotek,项目名称:advancedmvc,代码行数:9,代码来源:PersonController.cs

示例8: OnAddExecute

        private void OnAddExecute()
        {
            Log.Info("Adding new person");

            var person = new Person();

            Persons.Add(person);
            SelectedPerson = person;

            _flyoutService.ShowFlyout(ExampleEnvironment.PersonFlyoutName, SelectedPerson);
        }
开发者ID:WildGums,项目名称:Orchestra,代码行数:11,代码来源:PersonsViewModel.cs

示例9: Init

        public void Init()
        {
            _disaster = new Disaster {Id = 0, IsActive = true, Name = "Sharknado"};
            _cluster = new Cluster {Id = 1, Name = "Red Zone"};
            _person = new Person {Id = 2, FirstName = "John", LastName = "Doe"};

            _dataService = new Mock<IDataService>();
            _dataService.Setup(x => x.Disasters).Returns(new EnumerableQuery<Disaster>(new[] {_disaster}));
            _dataService.Setup(x => x.Clusters).Returns(new EnumerableQuery<Cluster>(new[] {_cluster}));
            _dataService.Setup(x => x.Persons).Returns(new EnumerableQuery<Person>(new[] {_person}));

            _clusterCoordinatorService = new Services.ClusterCoordinatorService(_dataService.Object);
        }
开发者ID:dayewah,项目名称:crisischeckin,代码行数:13,代码来源:AssignClusterCoordinatorTests.cs

示例10: Index

        public ActionResult Index(Person vm)
        {
            //ModelState.AddModelError(string.Empty, "Class level Error");
            //ModelState.AddModelError(string.Empty, "Class level Error 2");

            if (ModelState.IsValid)
                return Json(new { valid = ModelState.IsValid });
            else
            {
                var errorList = ModelState.ToModelStateJSON();

                return Json(new { valid = ModelState.IsValid, validationErrors = errorList });
            }
        }
开发者ID:travbod57,项目名称:MVCValidation,代码行数:14,代码来源:HomeController.cs

示例11: DataToApiModel

 public static ApiPerson DataToApiModel(Person person)
 {
     return new ApiPerson()
     {
         Id = person.Id,
         Username = person.Username,
         Email = person.Email,
         Password = person.Password,
         FirstName = person.FirstName,
         LastName = person.LastName,
         DOB = person.DOB,
         Gender = (ApiGender)person.Gender
     };
 }
开发者ID:andycornforth,项目名称:Training_Tracker,代码行数:14,代码来源:PersonMapper.cs

示例12: Init

        public void Init()
        {
            _coordinatorId = 42;
            _notCoordinatorId = 10;
            _dataService = new Mock<IDataService>();

            _disaster1 = new Disaster { Id = 1, IsActive = true, Name = "Sharknado" };
            _disaster2 = new Disaster { Id = 2, IsActive = true, Name = "Ice Age" };

            _cluster1 = new Cluster { Id = 2, Name = "Red Zone" };
            _cluster2 = new Cluster { Id = 3, Name = "Other Cluster" };

            _person1 = new Person { Id = 3, FirstName = "John", LastName = "Doe" };
            _person2 = new Person { Id = 4, FirstName = "Richard", LastName = "Roe" };
            _person3 = new Person { Id = 5, FirstName = "Little", LastName = "Toe" };

            _dataService.Setup(x => x.Disasters).Returns(new EnumerableQuery<Disaster>(new[]
            {
                _disaster1,
                _disaster2
            }));
            _dataService.Setup(x => x.Clusters).Returns(new EnumerableQuery<Cluster>(new[]
            {
                _cluster1,
                _cluster2
            }));
            _dataService.Setup(x => x.Persons).Returns(new EnumerableQuery<Person>(new[]
            {
                _person1,
                _person2,
                _person3
            }));
            _dataService.Setup(x => x.Commitments).Returns(new EnumerableQuery<Commitment>(new[]
            {
                new Commitment { DisasterId = _disaster1.Id, PersonId = _person1.Id },
                new Commitment { DisasterId = _disaster1.Id, PersonId = _person2.Id },
                new Commitment { DisasterId = _disaster2.Id, PersonId = _person3.Id }
            }));
            _clusterCoordinatorService = new Services.ClusterCoordinatorService(_dataService.Object);
        }
开发者ID:dayewah,项目名称:crisischeckin,代码行数:40,代码来源:GetClusterCoordinatorTests.cs

示例13: GetPersonDetailsForChangeContactInfoReturnsExpectedData

        public void GetPersonDetailsForChangeContactInfoReturnsExpectedData()
        {
            var personOne = new Person
            {
                Id = 1,
                UserId = 6,
                FirstName = "Cathy",
                LastName = "Jones",
                Email = "[email protected]",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            };

            var personTwo = new Person
            {
                Id = 2,
                UserId = 7,
                FirstName = "Stan",
                LastName = "Smith",
                Email = "[email protected]",
                PhoneNumber = "111-333-2222"
            };

            var dataService = new Mock<IDataService>();
            var personList = new List<Person>
            {
                personOne,
                personTwo
            };
            dataService.Setup(x => x.Persons).Returns(personList.AsQueryable());
            var underTest = new VolunteerService(dataService.Object);

            var result = underTest.GetPersonDetailsForChangeContactInfo(personTwo.UserId.GetValueOrDefault());

            Assert.IsNotNull(result);
            Assert.AreEqual(personTwo.Email, result.Email);
            Assert.AreEqual(personTwo.PhoneNumber, result.PhoneNumber);
        }
开发者ID:vkarosas,项目名称:crisischeckin,代码行数:38,代码来源:VolunteerServiceTest.cs

示例14: PostPerson

        /// <summary>
        /// Http : POST
        /// </summary>
        public async Task PostPerson()
        {
            await Task.Run(async () =>
            {
                using (RESTWebClient client = new RESTWebClient())
                {
                    string postUrl = "http://localhost:8001/people";
                    Person newPerson = new Person();
                    newPerson.FirstName = string.Format("FirstName_{0}", DateTime.Now.Ticks);
                    newPerson.LastName = string.Format("LastName_{0}", DateTime.Now.Ticks);

                    //the server PersonHandler [RouteBaseAttribute] is set to return Xml, 
                    //so we need to deserialize it as Xml 
                    var response = await client.Post<Person>(postUrl, newPerson, SerializationToUse.Xml);
                    Console.WriteLine("Http : POST");
                    Console.WriteLine("Status Code : {0}", response.StatusCode);
                    Console.WriteLine(postUrl);
                    Console.WriteLine(response.Content);
                    Console.WriteLine("=================================");

                }
            });
        }
开发者ID:mathewdenis,项目名称:REST,代码行数:26,代码来源:PersonClient.cs

示例15: GetPhisicPersonData

 public static DataTable GetPhisicPersonData(int icompany, int iperson, string stypeperson)
 {
     Person Person = new Person();
     return Person.GetPhisicPersonData(icompany, iperson, stypeperson);
 }
开发者ID:njmube,项目名称:CFDI-3,代码行数:5,代码来源:PersonBLL.cs


注:本文中的Models.Person类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。