1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
using System;
using System.ServiceModel;
using System.Runtime.Serialization;
using nsPersonne;
using System.Collections;
using Services;
namespace myService
{
[ServiceContract()]
public interface Ic2iService
{
[OperationContract]
string ConcatNames(string firstName, string lastName);
[OperationContract]
Personne GetChef();
[OperationContract]
ListWrapper GetTab();
}
public class c2iServiceImplementation : Ic2iService
{
public string ConcatNames(string firstName, string lastName)
{
Console.WriteLine(firstName);
return string.Format("Bonjour {0} {1}", firstName, lastName);
}
public Personne GetChef()
{
Personne p = new Personne();
p.Nom = "M";
p.Prenom = "v";
p.Age = 30;
return p;
}
public ListWrapper GetTab()
{
ListWrapper lw = new ListWrapper();
int iCpt;
for (iCpt = 0; iCpt <= 5; iCpt++)
{
Personne p = new Personne();
p.Nom = "lenom" + Convert.ToString(iCpt);
p.Prenom = "leprenom" + Convert.ToString(iCpt);
p.Age = 1 + iCpt;
lw.List.Add(p);
}
return lw;
}
}
} |
Partager