Esempio n. 1
0
 public bool PutParticipant(participant participant)
 {
     try
     {
         if (ValidatorParticipant.IsParticipantExist(participant, GetAllParticipant()) && ValidatorParticipant.IsValide(participant))
         {
             db.Entry(participant).State = EntityState.Modified;
             db.SaveChanges();
             return(true);
         }
         else if (!ValidatorParticipant.IsParticipantExist(participant, GetAllParticipant()))
         {
             throw new ItemNotExistException("participant");
         }
         else
         {
             throw new InvalidItemException("participant");
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 2
0
 public bool PostParticipant(participant participant)
 {
     try
     {
         if (ValidatorParticipant.IsValide(participant) && !ValidatorParticipant.IsParticipantExist(participant, GetAllParticipant()))
         {
             db.participants.Add(participant);
             db.SaveChanges();
             return(true);
         }
         else if (ValidatorParticipant.IsParticipantExist(participant, GetAllParticipant()))
         {
             throw new ExistingItemException("participant");
         }
         else
         {
             throw new InvalidItemException("participant");
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }