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
| [ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,
ConcurrencyMode = ConcurrencyMode.Multiple)]
public class ServiceSession
{
private SynchronizedCollection<Session> Sessions = new SynchronizedCollection<Session>();
public ServiceSession()
{
}
[OperationContract]
public List<Session> GetListSessions()
{
List<Session> result = null;
try
{
result = this.Sessions.ToList();
}
catch (Exception e)
{
if (log.IsErrorEnabled)
{
log.Error("Création d'une session de cours impossible", e);
}
result = null;
}
return result;
}
[OperationContract]
public bool CreateCoursesSession(Teacher auteur, string name)
{
bool result = false;
try
{
Session session = new Session(auteur, name);
this.Sessions.Add(session);
result = true;
}
catch (Exception e)
{
if (log.IsErrorEnabled)
{
log.Error("Création d'une session de cours impossible", e);
}
result = false;
}
return result;
} |
Partager