public async Task <IActionResult> Edit(int id, ContactPersonCreateViewModel personVM) { try { if (id.ToString() != personVM.ContactId) { return(Json(JsonResponse.Error("The contact person do not found", null, MessageInfoType.Error))); } if (ModelState.IsValid) { var user = Mapper.Map <MS_PIC>(personVM); var row = await ContPersonService.Update(user); if (row == 0) { return(Json(JsonResponse.Success("No data updated", null, MessageInfoType.Info))); } else { return(Json(JsonResponse.Success("The user was successfully updated", null, MessageInfoType.Success))); } } return(Json(JsonResponse.Error("Insufficient data", null, MessageInfoType.Error))); } catch (Exception ex) { return(Json(JsonResponse.Error(ex.Message, null, MessageInfoType.Error))); } }