public void EditCustomerContact(AdminCustomerContactVM contact, int id)
 {
     if (contact != null)
     {
         CustomerContact model;
         using (ApplicationDbContext db = new ApplicationDbContext())
         {
             model = db.CustomerContacts.FirstOrDefault(x => x.CustomerContactID == id);
             model.Name = contact.Name;
             model.UserID = contact.UserID;
             model.Department = contact.Department;
             model.Title = contact.Title;
             model.MobileNumber = contact.MobileNumber;
             model.WorkNumber = contact.WorkNumber;
             model.FaxNumber = contact.FaxNumber;
             model.Skype = contact.Skype;
             model.Email = contact.Email;
             db.SaveChanges();
         };
     };
 }
 public IHttpActionResult Post(AdminCustomerContactVM contact)
 {
     AdminCustomerContactVM newcontact = _adapter.NewCustomerContact(contact);
     return Ok(newcontact);
 }
 public IHttpActionResult Post(AdminCustomerContactVM contact, int id)
 {
     _adapter.EditCustomerContact(contact, id);
     return Ok();
 }
 public AdminCustomerContactVM NewCustomerContact(AdminCustomerContactVM contact)
 {
     if (contact != null)
     {
         CustomerContact model = new CustomerContact()
         {
             Name = contact.Name,
             UserID = contact.UserID,
             Department = contact.Department,
             Title = contact.Title,
             MobileNumber = contact.MobileNumber,
             WorkNumber = contact.WorkNumber,
             FaxNumber = contact.FaxNumber,
             Skype = contact.Skype,
             Email = contact.Email
         };
         using (ApplicationDbContext db = new ApplicationDbContext())
         {
             db.CustomerContacts.Add(model);
             db.SaveChanges();
         }
     }
     return contact;
 }