Ejemplo n.º 1
0
 public void PutContact(int id,Contact contact)
 {
     contact.ContactId=id;
      if (!repository.Update(contact))
     {
         throw new ArgumentNullException("Ops ! Contact object is null that was sended !");
     }
 }
Ejemplo n.º 2
0
 public void Post(Contact newContact)
 {
     if (newContact == null)
     {
         throw new ArgumentNullException("Opps ! Contact object is null that was sended !");
     }
     newContact.ContactId= _nextId++;
     contacts.Add(newContact);
 }
Ejemplo n.º 3
0
 public bool Update(Contact updatedContact)
 {
     if (updatedContact == null)
     {
         throw new ArgumentNullException("Opps ! Contact object is null that was sended !");
     }
     else
     {
         var contact = this.Get(updatedContact.ContactId);
         if (contact.ContactId == -1)                            // there is no contact object with that id
         {
             return false;
         }
         contact.Name = updatedContact.Name;
         contact.Email = updatedContact.Email;
         contact.MobilePhone = updatedContact.MobilePhone;
         contact.WorkPhone = updatedContact.WorkPhone;
         contact.JobTitle = updatedContact.JobTitle;
         contact.Manager = updatedContact.Manager;
         contact.Departman = updatedContact.Departman;
         return true;
     }
 }
Ejemplo n.º 4
0
 public void PostContact(Contact newContact)
 {
     repository.Post(newContact);
 }