public ResponseModel Post(ContactPerson contactPerson)
 {
     ResponseModel response;
     try
     {
         int save = _contactPersonService.Save(contactPerson);
         response = save > 0 ? new ResponseModel(save) : new ResponseModel(null, false, "Couldn't save");
     }
     catch (Exception exception)
     {
         response = new ResponseModel(null, false, "Error occurred", exception);
     }
     return response;
 }
 public int Save(ContactPerson contactPerson)
 {
     ContactPerson _contactPerson ;
     if (contactPerson.Id>0)
     {
         _contactPerson = _contactPersonRepository.GetSingle(contactPerson.Id);
         if (_contactPerson !=null)
         {
             _contactPerson.Name = contactPerson.Name;
             _contactPerson.Phone = contactPerson.Phone;
             _contactPerson.Email = contactPerson.Email;
             _contactPerson.Organization = contactPerson.Organization;
             _contactPerson.Title = contactPerson.Title;
             _contactPerson.Address = contactPerson.Address;
         }
     }
     else
     {
         _contactPerson =_contactPersonRepository.Add(contactPerson);
     }
     _unitOfWork.Commit();
     return _contactPerson.Id;
 }
 public ResponseModel Get(int id)
 {
     ContactPerson contactPerson = _contactPersonService.GetById(id);
     contactPerson = new ContactPerson() { Id = contactPerson.Id, Name = contactPerson.Name, Phone = contactPerson.Phone, Email = contactPerson.Email, Organization = contactPerson.Organization, Title = contactPerson.Title, Address = contactPerson.Address };
     return new ResponseModel(contactPerson);
 }