public JsonResult Edit(EditVM model) { var result = new JsonResultBO(true); try { if (ModelState.IsValid) { var user = _appUserService.GetById(model.Id); if (user == null) { throw new Exception("Không tìm thấy thông tin"); } if (!string.IsNullOrEmpty(model.Email) && _appUserService.CheckExistEmail(model.Email, user.Id)) { throw new Exception(string.Format("Email {0} đã được sửa dụng", model.Email)); } if (user != null) { user.FullName = model.FullName; user.PhoneNumber = model.PhoneNumber; user.BirthDay = model.BirthDay; user.Address = model.Address; user.Gender = model.Gender; user.Email = model.Email; _appUserService.Update(user); } } } catch (Exception ex) { result.Status = false; result.Message = "Không cập nhật được"; _Ilog.Error("Lỗi cập nhật thông tin User", ex); } return(Json(result)); }