public Person GetPerson(int personId) { if (!this.HasPerson(personId)) { var errorMsg = new CustomFaultMsg("No Employee have ID: " + personId); throw new FaultException <CustomFaultMsg>(errorMsg); } return(this.personCollection.FirstOrDefault(x => x.PersonId == personId)); }
public void EditPerson(int personId, Person person) { Person p = this.GetPerson(personId); if (p == null) { var error = new CustomFaultMsg("No Employee have ID: " + personId); throw new FaultException <CustomFaultMsg>(error); } p.FullName = person.FullName; p.Age = person.Age; }