public async Task <IActionResult> UpdateStaffInfo(string Id, UpdateStaffInfoRequest request) { if (Id != request.Id) { return(BadRequest()); } return(Ok(await _userInfoService.UpdateStaffInfoRequest(request))); }
public async Task <Response <string> > UpdateStaffInfoRequest(UpdateStaffInfoRequest request) { var user = await _unitOfWork.UserRepository.FirstAsync(x => x.Id == request.Id && x.DelFlag == false, includeProperties : "UserInfo"); if (user == null) { return(new Response <string>(null, $"Không tìm thấy thông tin tài khoản \'{request.Id}\'.")); } user.UserInfo.FullName = request.FullName; user.UserInfo.ImageUrl = request.ImageURL; user.UserInfo.Birthday = request.BirthDay; user.UserInfo.Phonenumber = request.Phonenumber; _unitOfWork.UserRepository.UpdateAsync(user); await _unitOfWork.SaveAsync(); return(new Response <string>(user.Id, $"Cập nhật thông tin thành công, {user.Id}")); }