[HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit(ContactDetailViewModel model)
        {
            try
            {
                User user = _Login.GetCurrentUser();
                using (var dbContextScope = _dbContextScopeFactory.Create())
                {
                    
                    Contact contact = model;                    
                    _ContactRepo.UpdateContact(contact, user);
                    dbContextScope.SaveChanges();
                }
            }
            catch (RMException rme)
            {
                rme.Log();
                ModelState.AddModelError("", "Saving contact failed. Please check your values and try again.");
                return PartialView(model);
            }
            catch (Exception)
            {
                ModelState.AddModelError("", "Saving contact failed for an unknown reason. Please check your values and try again.");
                return PartialView(model);
            }
            return RedirectToAction("Index", "Contact");
}
 
-----------------------------------------------------------------------------------------------------------------------------------
 
public ActionResult UpdateContactAttribute(int key, String values)
        {
            using (var dbContextScope = _dbContextScopeFactory.Create())
            {
                var dbAttribute = _ContactRepo.GetContactAttribute(key);
                ContactViewModel.ContactAddressViewModel cvm = dbAttribute;
                JsonConvert.PopulateObject(values, cvm);
                User user = _Login.GetCurrentUser();
                _ContactRepo.UpdateContactAttribute(cvm, user);
                dbContextScope.SaveChanges();
            }
            return new HttpStatusCodeResult(HttpStatusCode.Created);
        }