예제 #1
0
        public async Task <JsonResult> SavePerson(Person person)
        {
            var result = await repository.AddPerson(person);

            if (result == "success")
            {
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            return(Json("error", JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        /// <summary>
        /// 添加人员信息
        /// </summary>
        protected override void ExecuteMethod()
        {
            IPerson personDao = DALFactory.GetPersonDao();

            if (this.personList != null && this.personList.Count > 0)
            {
                foreach (MPerson item in this.personList)
                {
                    personDao.AddPerson(this.Connection, this.Transation, item);
                }

                this.IsSuccess = true;
            }
        }
예제 #3
0
        public void Verify_PersonService()
        {
            mockPersonRepository.Setup(mpr =>
                                       mpr.AddPerson(It.IsAny <Person> ())).Returns(true);

            Person person = new Person {
                firstName = "One",
                lastName  = "Two"
            };
            bool result  = personService.AddPerson(person);
            var  persons = personService.GetAll();

            Assert.That(result, Is.EqualTo(true));
            Assert.That(persons.Count, Is.GreaterThan(0));
        }