public async Task <ActionResult> SaveEmployee(ContactViewModel model) { if (User == null) { return(null); } EmployeeManagment manage = new EmployeeManagment(_context); if (await manage.IsExistWithTheSameEmail(model.ContactId, model.EmailAddress)) { return(Json(new { status = "error", message = "A contact already exists for this email address. The account hasn't created." }, JsonRequestBehavior.AllowGet)); } if (!model.IsUpdate) { model.ContactId = 0; var dbModel = model.GetModel(); model.ContactId = await manage.SaveContact(dbModel); } else { var dbModel = model.GetModel(); model.ContactId = await manage.SaveContact(dbModel); } return(Json(new { status = "ok", id = model.ContactId }, JsonRequestBehavior.AllowGet)); }