public void SaveContact(Contact contact)
        {
            if (contact.ContactID == 0)
            {
                context.Contacts.Add(contact);
            }
            else
            {
                Contact dbEntry = context.Contacts.Find(contact.ContactID);
                if (dbEntry != null)
                {
                    dbEntry.Name = contact.Name;
                    dbEntry.PhoneNo = contact.PhoneNo;
                    //typo
                    dbEntry.AddressLine1 = contact.AddressLine1;
                    dbEntry.AddressLine2 = contact.AddressLine2;
                    dbEntry.Suburb = contact.Suburb;
                    dbEntry.State = contact.State;
                    //typo
                    dbEntry.PostCode = contact.PostCode;
                    dbEntry.Country = contact.Country;

                }
            }
            context.SaveChanges();
        }
 public ActionResult Edit(Contact contact)
 {
     if (ModelState.IsValid)
     {
         contacts.SaveContact(contact);
         TempData["message"] = string.Format("Contact details have been saved");
         return RedirectToAction("Index");
     }
     else
     {
         //there is something wrong with the data vaues
         return View();
     }
 }