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)); }
/// <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; } }
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)); }