• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Models.Person类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: WhenQueryingReturnCommitmentsOnlyForThisUser

        public void WhenQueryingReturnCommitmentsOnlyForThisUser()
        {
            var moqDataService = new Mock<IDataService>();
            var disaster = new Disaster
            {
                Id = 1,
                Name = "test",
                IsActive = true
            };
            moqDataService.Setup(ds => ds.Disasters)
                .Returns(new List<Disaster>
                {
                    disaster
                }.AsQueryable());

            moqDataService.Setup(ds => ds.Commitments)
                .Returns(new List<Commitment>
                {
                    new Commitment
                    {
                        DisasterId=1,
                        Id = 1,
                        PersonId=1,
                        StartDate=new DateTime(2013, 8, 1),
                        EndDate = new DateTime(2013, 9, 1),
                        Disaster=disaster
                    },
                    new Commitment
                    {
                        DisasterId=1,
                        Id = 2,
                        PersonId=2,
                        StartDate=new DateTime(2013, 8, 1),
                        EndDate = new DateTime(2013, 9, 1)
                    }
                }.AsQueryable());
            var underTest = new VolunteerService(moqDataService.Object);

            var person = new Person
            {
                Id = 1,
                FirstName = "test",
                LastName = "tester"
            };
            var results = underTest.RetrieveCommitmentsForDisaster(person, disaster);
            Assert.IsTrue(results.Count() == 1);
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:47,代码来源:VolunteerServiceTest.cs


示例17: GetfiscalAddresFromPersonNumber

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


示例18: WhenNoCommitmentsExistEmptyCollectionIsReturned

        public void WhenNoCommitmentsExistEmptyCollectionIsReturned()
        {
            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(ds => ds.Commitments)
                .Returns(new List<Commitment>().AsQueryable());
            var underTest = new VolunteerService(moqDataService.Object);

            var person = new Person
            {
                Id = 1,
                FirstName = "test",
                LastName = "tester"
            };
            var disaster = new Disaster
            {
                Id = 1,
                Name = "test",
                IsActive = true
            };
            moqDataService.Setup(ds => ds.Disasters)
                .Returns(new List<Disaster>
                {
                    disaster
                }.AsQueryable());

            var results = underTest.RetrieveCommitmentsForDisaster(person, disaster);
            Assert.IsTrue(results.Count() == 0);
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:28,代码来源:VolunteerServiceTest.cs


示例19: WhenDisasterIsNullGetCommitmentsThrowsNullArgumentException

        public void WhenDisasterIsNullGetCommitmentsThrowsNullArgumentException()
        {
            var moqDataService = new Mock<IDataService>();
            var underTest = new VolunteerService(moqDataService.Object);

            var person = new Person
            {
                Id = 1,
                FirstName = "test",
                LastName = "tester"
            };

            var results = underTest.RetrieveCommitmentsForDisaster(person, default(Disaster));
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:14,代码来源:VolunteerServiceTest.cs


示例20: UpdateDetails_Valid

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

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

            var moqDataService = new Mock<IDataService>();
            moqDataService.Setup(s => s.Persons).Returns(people.AsQueryable());
            moqDataService.Setup(s => s.UpdatePerson(It.IsAny<Person>())).Returns(new Person() {
                Id = 1,
                Email = "[email protected]",
                FirstName = "Cathy",
                LastName = "CHANGED",
                PhoneNumber = "555-222-9139",
                ClusterId = 1
            });

            VolunteerService service = new VolunteerService(moqDataService.Object);
            var actual = service.UpdateDetails(new Person()
            {
                Id = 1, Email = "[email protected]", FirstName = "Cathy", LastName = "CHANGED", PhoneNumber = "555-222-9139", ClusterId = 1
            });

            // Only Last Name has been updated
            Assert.AreEqual("CHANGED", actual.LastName);

            Assert.AreEqual("Cathy", actual.FirstName);
        }
开发者ID:jfazler,项目名称:crisischeckin,代码行数:38,代码来源:VolunteerServiceTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Models.Product类代码示例发布时间:2022-05-26
下一篇:
C# Models.Disaster类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap