コード例 #1
0
        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));
        }
コード例 #2
0
        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;
        }