public ChangePhotoResponse ChangePhoto(ISession session, ChangePhotoRequest request)//TODO: define request { var response = request.CreateResponse<ChangePhotoResponse>(); response.Success = true; int photoId = request.BuiltinPhotoId; if (!request.PhotoData.IsNullOrEmpty() && request.PhotoData.Length > 10) { try { photoId = _fileStorage.AppendFile(request.PhotoData); } catch (Exception exc) { photoId = 0; response.Success = false; } } response.PhotoId = photoId; if (response.Success) { using (var uow = UnitOfWorkFactory.Create()) { uow.Attach(session.User); session.User.ChangePhoto(photoId); uow.Commit(); } _profileChangesNotificator.NotifyEverybodyInChatAboutProfileChanges(session.User.Id, new Dictionary<string, object> { { "PhotoId", photoId } }); } return response; }
public Task<ChangePhotoResponse> ChangePhoto(ChangePhotoRequest request) { return ConnectionManager.SendRequestAndWaitResponse<ChangePhotoResponse>(request); }