public JsonResult GetUserProfileById(long id) { try { var obj = _userProfileBusiness.GetById(id); if (obj != null) { Common.UserProfile objentity = new Common.UserProfile(); objentity.Code = obj.Code; objentity.Address = obj.Address; objentity.Dob = obj.Dob; objentity.Email = obj.Email; objentity.Name = obj.Name; objentity.Phone = obj.Phone; objentity.Id = obj.Id; objentity.Dob = obj.Dob; objentity.DepartmentId = obj.DepartmentId; objentity.Description = obj.Description; return(Json(objentity, JsonRequestBehavior.AllowGet)); } else { return(Json(0)); } } catch (Exception) { //Write log throw; } }
public JsonResult UpdateUserProfile(Common.UserProfile obj) { try { UserProfileBusiness _userProfileBusiness = new UserProfileBusiness(); var entity = _userProfileBusiness.GetById(obj.Id); entity.Code = obj.Code; entity.Address = obj.Address; entity.Dob = obj.Dob; entity.Email = obj.Email; entity.Name = obj.Name; entity.Phone = obj.Phone; entity.Id = obj.Id; entity.Dob = obj.Dob; entity.DepartmentId = obj.DepartmentId; entity.Description = obj.Description; _userProfileBusiness.Edit(entity); return(Json(1));//Cập nhật thành công } catch (Exception) { throw; } }