Пример #1
0
        public override async Task <IOperationResult> CreateAsync(Model.DataModel.Amendment item, int userId)
        {
            var results = await base.CreateAsync(item, userId);

            var user = await _userService.GetForToastAsync(userId);

            item = await GetAsync(item.Id);

            await _clientNotifier.SendToAllAsync(DestinationHub.Amendment, ClientNotifierMethods.AmendmentChange, new { id = item.Id, results, data = item, user });

            return(results);
        }
        public override async Task <IOperationResult> UpdateAsync(SystemSetting item, int userId)
        {
            var output = await base.UpdateAsync(item, userId);

            if (output.Succeeded)
            {
                await _clientNotifier.SendToAllAsync(DestinationHub.Screen, ClientNotifierMethods.RefreshSetting, item);

                await _clientNotifier.SendToAllAsync(DestinationHub.Amendment, ClientNotifierMethods.RefreshSetting, item);
            }
            return(output);
        }
        public async Task GoLiveAsync(int userId, int amendmentId, bool isLive)
        {
            var amendment = await _amendmentRepository.GetByIdAsync(amendmentId);

            if (amendment != null)
            {
                var user = await _userService.GetForToastAsync(userId);

                _amendmentRepository.SetIsLive(isLive, amendment);
                await _unitOfWork.SaveChangesAsync(userId);

                await _clientNotifier.SendToAllAsync(DestinationHub.Amendment, ClientNotifierMethods.AmendmentChange, new { id = amendmentId, results = new OperationResult(OperationType.GoLive), data = amendment, isLive, user });
                await UpdateAmendmentAsync(amendment);
            }
        }