Пример #1
0
        public async Task <IActionResult> UpdateUserAsync(string id, UpdateDto model)
        {
            var user = _mapper.Map <User>(model);

            user.Id = id;

            try
            {
                AuthorizationResult isAuthorized =
                    await AuthorizationService.AuthorizeAsync(User, id, DotsAuthRequirements.Update);

                if (!isAuthorized.Succeeded)
                {
                    return(Forbid());
                }

                await _userRepository.UpdateUserAsync(user, model.Password);

                return(Ok());
            }
            catch (AppException ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
Пример #2
0
        public async Task <BotResponseCode> TryHandleInlineQuery(UpdateDto updateDto)
        {
            // If the bot can't do anything with the update's inline query, we're done.
            if (!CanHandleInlineQuery(updateDto))
            {
                // If there is an id, let telegram know the inline query has been handled.
                if (!string.IsNullOrEmpty(updateDto.ParsedUpdateId))
                {
                    await _sendMessageService.AnswerInlineQuery(updateDto.ParsedUpdateId, new List <InlineQueryResultArticle>());
                }

                return(BotResponseCode.NoAction);
            }

            // Check if any command should be handled and if so handle it.
            var commandResponseCode = await _inlineQueryCommandsService.TryHandleCommand(updateDto);

            if (commandResponseCode != BotResponseCode.NoAction)
            {
                return(commandResponseCode);
            }

            // This should never happen.
            throw new InlineQueryNotHandledException();
        }
Пример #3
0
        public async Task <BotResponseCode> TryHandleMessage(UpdateDto updateDto)
        {
            // If the bot can't do anything with the update's message, we're done.
            if (!CanHandleMessage(updateDto))
            {
                return(BotResponseCode.NoAction);
            }

            // Check if any command should be handled and if so handle it.
            var commandResponseCode = await _handleCommandService.TryHandleCommand(updateDto);

            if (commandResponseCode != BotResponseCode.NoAction)
            {
                return(commandResponseCode);
            }

            // Try to add a spotify track url that was in the message to the playlist.
            var addTrackResponseCode = await _addTrackService.TryAddTrackToPlaylist(updateDto);

            if (addTrackResponseCode != BotResponseCode.NoAction)
            {
                if (addTrackResponseCode == BotResponseCode.TrackAddedToPlaylist)
                {
                    // Save users that added tracks to the playlist.
                    await _userService.SaveUser(updateDto.ParsedUser, updateDto.ParsedChat.Id);
                }

                return(addTrackResponseCode);
            }

            // This should never happen.
            throw new MessageNotHandledException();
        }
Пример #4
0
        public void Update(UpdateDto dto)
        {
            var user = _repo.Get(dto.Id);

            user.Act1     = dto.Act1;
            user.Act2     = dto.Act2;
            user.Act3     = dto.Act3;
            user.ActOther = dto.ActOther;

            user.Eat1     = dto.Eat1;
            user.Eat2     = dto.Eat2;
            user.Eat3     = dto.Eat3;
            user.Eat4     = dto.Eat4;
            user.Eat5     = dto.Eat5;
            user.Eat6     = dto.Eat6;
            user.EatOther = dto.EatOther;

            user.Drink1 = dto.Drink1;
            user.Drink2 = dto.Drink2;
            user.Drink3 = dto.Drink3;
            user.Drink4 = dto.Drink4;

            user.DrinkOther = dto.DrinkOther;

            user.Alco1     = dto.Alco1;
            user.Alco2     = dto.Alco2;
            user.Alco3     = dto.Alco3;
            user.Alco4     = dto.Alco4;
            user.Alco5     = dto.Alco5;
            user.AlcoOther = dto.AlcoOther;

            _repo.Update(user);
        }
Пример #5
0
        /// <summary>
        /// Check if the bot can handle the update's message.
        /// </summary>
        private bool CanHandleMessage(UpdateDto updateDto)
        {
            // Check if we have all the data we need.
            if (
                // Filter everything but messages.
                updateDto.ParsedUpdateType != UpdateType.Message ||
                string.IsNullOrEmpty(updateDto.ParsedTextMessage))
            {
                return(false);
            }

            // Always handle commands.
            if (_handleCommandService.IsAnyCommand(updateDto.ParsedTextMessage))
            {
                return(true);
            }

            // If no playlist was set for this chat, we're done.
            if (updateDto.Chat == null || updateDto.Playlist == null)
            {
                return(false);
            }

            if (!_spotifyTextHelper.HasAnyTrackLink(updateDto.ParsedTextMessage))
            {
                return(false);
            }

            return(true);
        }
        public UpdateResult pickInterest(UpdateDto sponsor)
        {
            UpdateResult result = null;

            var filter = Builders <Sponsor> .Filter.Eq("Id", sponsor.Id);

            Sponsor s = _sponsors.Find(s => s.Id == sponsor.Id).FirstOrDefault();

            if (s.Interests == null)
            {
                var update = Builders <Sponsor> .Update.Set("Interests", sponsor.Interests);

                result = _sponsors.UpdateOne(filter, update);
            }
            else
            {
                List <string> list = s.Interests;
                sponsor.Interests.ForEach(interest => list.Add(interest));
                var update = Builders <Sponsor> .Update.Set("Interests", list);

                result = _sponsors.UpdateOne(filter, update);
            }



            return(result);
        }
Пример #7
0
        public async Task <UpdateDto> GetUniversitiesListUpdate(DateTime?currentTimeStamp)
        {
            UpdateInfo update = await Context.Updates.AsNoTracking()
                                .FirstOrDefaultAsync(u => string.Equals(u.TableName, nameof(Context.Universities)));

            var noUpdateNeeded = new UpdateDto()
            {
                NeedUpdate = false,
            };

            if (update == null)
            {
                await MarkAsUpdated(nameof(Context.Universities));

                return(noUpdateNeeded);
            }

            if (!currentTimeStamp.HasValue || currentTimeStamp.Value < update.TimeStamp)
            {
                return new UpdateDto()
                       {
                           NeedUpdate = true,
                           IsFinished = update.IsFinished,
                           TimeStamp  = update.TimeStamp
                       }
            }
            ;

            return(noUpdateNeeded);
        }
Пример #8
0
        private bool ShouldHandle(UpdateDto updateDto)
        {
            if (updateDto == null)
            {
                return(false);
            }

            // Always handle inline queries, since they do not have chat info.
            if (updateDto.ParsedUpdateType == UpdateType.InlineQuery)
            {
                return(true);
            }

            var chatType = updateDto.ParsedChat?.Type;

            if (!chatType.HasValue)
            {
                return(false);
            }

            switch (chatType.Value)
            {
            case ChatType.Group:
            case ChatType.Supergroup:
                return(true);

            case ChatType.Private:
                // The only thing the bot handles in a private chat is one of the following commands.
                return(IsStartCommand(updateDto) || IsGetLoginLinkCommand(updateDto));

            case ChatType.Channel:
            default:
                return(false);
            }
        }
Пример #9
0
        /// <summary>
        /// Check if a message contains a command and if so, handle it.
        /// </summary>
        /// <returns>A BotResponseCode if a command was handled, or NoAction if no matching command was found.</returns>
        public async Task <BotResponseCode> TryHandleCommand(UpdateDto updateDto)
        {
            foreach (var command in Enum.GetValues(typeof(TCommand)).Cast <TCommand>())
            {
                if (_commandsService.IsCommand(updateDto.ParsedTextMessage, command))
                {
                    var errorText = await ValidateRequirements(command, updateDto);

                    if (!string.IsNullOrEmpty(errorText))
                    {
                        // If there is a chat, answer with the errorText.
                        if (updateDto.ParsedChat != null)
                        {
                            await _sendMessageService.SendTextMessage(updateDto.ParsedChat.Id, errorText);
                        }

                        return(BotResponseCode.CommandRequirementNotFulfilled);
                    }

                    var responseCode = await HandleCommand(command, updateDto);

                    if (responseCode != BotResponseCode.NoAction)
                    {
                        return(responseCode);
                    }
                }
            }

            return(BotResponseCode.NoAction);
        }
Пример #10
0
        public async Task <LongPollingResponse> GetTaskEightData([FromBody] LongPollingRequest request)
        {
            UpdateDto update = null;

            UniversityDto[] dtos            = null;
            int             iterationsCount = ITERATIONS_COUNT;

            do
            {
                update = await updatesService.GetUniversitiesListUpdate(request.TimeStamp);

                if (update.NeedUpdate)
                {
                    dtos = universitiesService.GetUniversitiesAboveRating(VSU_RATING);
                    break;
                }

                if (iterationsCount == 0)
                {
                    await NoContent().ExecuteResultAsync(ControllerContext);

                    return(null);
                }

                iterationsCount--;
                await Task.Delay(MS_DELAY);
            }while (!update.NeedUpdate);

            return(new LongPollingResponse()
            {
                IsFinished = update.IsFinished,
                TimeStamp = update.TimeStamp,
                Universities = dtos
            });
        }
        public async Task TestUpdateUser()
        {
            try
            {
                _usersController.ControllerContext =
                    new ControllerContext {
                    HttpContext = new DefaultHttpContext()
                };

                _usersController.ControllerContext.HttpContext.Request.Headers["Authorization"] =
                    $"Bearer: {tokenString}";

                Func <string, User> getUser = (id) => _usersCollection.Find(u => u.Id == id).FirstOrDefault();

                UpdateDto updateDto = new UpdateDto()
                {
                    Email = "newEmail"
                };

                await _usersController.UpdateUserAsync("60848ae8fb71edf2a7ebf846", updateDto);

                User user = getUser("60848ae8fb71edf2a7ebf846");
                Assert.AreEqual("newEmail", user.Email);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                await _usersCollection.DeleteOneAsync(u => u.Id == "60848ae8fb71edf2a7ebf846");
            }
        }
Пример #12
0
        public async Task ProcessMessageAsync(UpdateDto update)
        {
            string text       = update.Message.Text.Trim();
            int    userChatId = update.Message.Chat.Id;

            BotCommand command = await _botCommandParserService.ParseCommand(text, userChatId);

            if (command != null)
            {
                command.UserChatId = userChatId;
            }

            if (command is ShowTodoCommand showTodoCommand)
            {
                await _showTodoCommandProcessor.ProcessAsync(showTodoCommand);

                return;
            }

            if (command is StartCommand startCommand)
            {
                await _startCommandProcessor.ProcessAsync(startCommand);

                return;
            }

            if (command is CreateTaskCommand createTaskCommand)
            {
                await _createTaskCommandProcessor.ProcessAsync(createTaskCommand);

                return;
            }

            await _botSendMessageService.SendUnknownCommandAsync(userChatId);
        }
Пример #13
0
        public async Task ProcessUpdateAsync(UpdateDto dto)
        {
            string text = null;

            switch (dto.Message.Chat.Type)
            {
            case ChatType.Private:
                text = dto.Message.Text;
                break;

            case ChatType.Group:
            case ChatType.Supergroup:
                var messageText        = dto.Message.Text;
                var messageMentionsBot = dto.Message.Entities != null &&
                                         dto.Message.Entities.Any(e =>
                                                                  e.Type == MessageEntityType.Mention &&
                                                                  messageText.Substring(e.Offset, e.Length) == BotId);
                if (messageMentionsBot)
                {
                    text = dto.Message.ReplyToMessage?.Text ?? dto.Message.Text;
                }
                break;
            }
            if (string.IsNullOrEmpty(text))
            {
                return;
            }
            text = text.Replace(BotId, string.Empty).Trim();
            if (!string.IsNullOrEmpty(text) && text.Length <= 1000)
            {
                var translated = await _translationService.TranslateAsync(text);

                await _telegramApi.SendMessageAsync(dto.Message.Chat.Id, translated, dto.Message.MessageId);
            }
        }
        /// <summary>
        /// Check if the bot can handle the update's callback query.
        /// </summary>
        /// <returns>True if the bot can handle the callback query.</returns>
        private bool CanHandleCallbackQuery(UpdateDto updateDto)
        {
            // Check if we have all the data we need.
            if (
                // Filter everything but callback queries.
                updateDto.ParsedUpdateType != UpdateType.CallbackQuery ||
                string.IsNullOrEmpty(updateDto.ParsedUpdateId) ||
                updateDto.ParsedUser == null ||
                !updateDto.ParsedBotMessageId.HasValue ||
                string.IsNullOrEmpty(updateDto.ParsedTextMessage) ||
                string.IsNullOrEmpty(updateDto.ParsedTrackId) ||
                // Only handle callback queries in registered chats with a playlist.
                updateDto?.Chat == null ||
                updateDto?.Playlist == null ||
                updateDto?.Track == null ||
                // Removed tracks cannot be voted on, or added to the queue.
                updateDto?.Track?.State == Spotify.Tracks.TrackState.RemovedByDownvotes)
            {
                return(false);
            }

            if (_voteService.IsAnyVoteCallback(updateDto))
            {
                return(true);
            }

            if (IsAddToQueueCallback(updateDto))
            {
                return(true);
            }

            return(false);
        }
Пример #15
0
        public ActionResult updatePractice(UpdateDto updateDto)
        {
            var date        = updateDto.examDateForUpdate;
            var persianTime = PersianDateTime.Parse(date);
            var dateTime    = persianTime.ToDateTime();

            var        courseIds = updateDto.courseIdsForUpdate;
            List <int> grades    = new List <int> {
            };

            foreach (var item in updateDto.Grades)
            {
                if (item == "نمره")
                {
                    continue;
                }
                grades.Add(int.Parse(item));
            }

            for (int i = 0; i < grades.Count(); i++)
            {
                var cid    = courseIds[i];
                var result = _context.Practices.SingleOrDefault(s => s.PracticeDate == dateTime && s.CourseID == cid);
                if (result != null)
                {
                    result.PassedNumbers = grades[i];
                    _context.SaveChanges();
                }
            }

            return(Json(new { success = true, responseText = "تکلیف بروزرسانی شد" }, JsonRequestBehavior.AllowGet));
        }
Пример #16
0
 /// <summary>
 /// Edit the message that triggered the callback query.
 /// </summary>
 /// <param name="updateDto">The update with the callback query.</param>
 /// <param name="newText">The new text to replace the message text with.</param>
 /// <param name="replyMarkup">The keyboard to use.</param>
 private Task EditOriginalMessage(UpdateDto updateDto, string newText, InlineKeyboardMarkup replyMarkup)
 {
     return(_sendMessageService.EditMessageText(
                updateDto.Chat.Id,
                updateDto.ParsedBotMessageId.Value,
                newText,
                replyMarkup: replyMarkup));
 }
Пример #17
0
 /// <summary>
 /// Reply when a track has been added to the playlist.
 /// </summary>
 private async Task SendReplyMessage(UpdateDto updateDto, Track track)
 {
     await _sendMessageService.SendTextMessage(
         updateDto.Chat.Id,
         _successResponseService.GetSuccessResponseText(updateDto, track),
         replyToMessageId : int.Parse(updateDto.ParsedUpdateId),
         replyMarkup : _keyboardService.CreatePostedTrackResponseKeyboard());
 }
Пример #18
0
        /// <summary>
        /// Check if an update contains an vote callback and if so, handle it.
        /// </summary>
        /// <param name="updateDto">The update to handle.</param>
        public Task <BotResponseCode> TryHandleVote(UpdateDto updateDto)
        {
            if (!IsAnyVoteCallback(updateDto))
            {
                return(Task.FromResult(BotResponseCode.NoAction));
            }

            return(HandleVote(updateDto, GetVoteType(updateDto).Value));
        }
Пример #19
0
        /// <summary>
        /// Check if an update contains a Vote.
        /// </summary>
        /// <returns>True if the update is a Vote callback.</returns>
        private bool IsVoteCallback(UpdateDto updateDto, VoteType voteType)
        {
            if (string.IsNullOrEmpty(updateDto.ParsedData))
            {
                return(false);
            }

            return(updateDto.ParsedData.Equals(KeyboardService.GetVoteButtonText(voteType)));
        }
Пример #20
0
        public async Task <BotResponseCode> TryAddTrackToPlaylist(UpdateDto updateDto)
        {
            if (string.IsNullOrEmpty(updateDto.ParsedTrackId))
            {
                return(BotResponseCode.NoAction);
            }

            var existingTrackInPlaylist = await _trackRepository.Get(updateDto.ParsedTrackId, updateDto.Chat.PlaylistId);

            // Check if the track already exists in the playlist.
            if (existingTrackInPlaylist != null)
            {
                string text;
                if (existingTrackInPlaylist.State == TrackState.RemovedByDownvotes)
                {
                    text = $"This track was previously posted, but it was downvoted and removed from the {_spotifyLinkHelper.GetMarkdownLinkToPlaylist(updateDto.Chat.PlaylistId, "playlist")}.";
                }
                else
                {
                    text = $"This track is already added to the {_spotifyLinkHelper.GetMarkdownLinkToPlaylist(updateDto.Chat.PlaylistId, "playlist")}!";
                }

                await _sendMessageService.SendTextMessage(updateDto.Chat.Id, text);

                return(BotResponseCode.TrackAlreadyExists);
            }

            var spotifyClient = await _spotifyClientFactory.Create(updateDto.Chat.AdminUserId);

            // We can't continue if we can't use the spotify api.
            if (spotifyClient == null)
            {
                await _sendMessageService.SendTextMessage(updateDto.Chat.Id, "Spoti-bot is not authorized to add this track to the Spotify playlist.");

                return(BotResponseCode.NoAction);
            }

            // Get the track from the spotify api.
            var newTrack = await _spotifyClientService.GetTrack(spotifyClient, updateDto.ParsedTrackId);

            if (newTrack == null)
            {
                await _sendMessageService.SendTextMessage(updateDto.Chat.Id, $"Track not found in Spotify api :(");

                return(BotResponseCode.NoAction);
            }

            await AddTrack(spotifyClient, updateDto.ParsedUser, newTrack, updateDto.Chat.PlaylistId);

            // Reply that the message has been added successfully.
            await SendReplyMessage(updateDto, newTrack);

            // Add the track to my queue.
            await _spotifyClientService.AddToQueue(spotifyClient, newTrack);

            return(BotResponseCode.TrackAddedToPlaylist);
        }
        public async Task <BotResponseCode> TryHandleCallbackQuery(UpdateDto updateDto)
        {
            // If the bot can't do anything with the update's callback query, we're done.
            if (!CanHandleCallbackQuery(updateDto))
            {
                return(BotResponseCode.NoAction);
            }

            // Check if a vote should be handled and if so handle it.
            var voteResponseCode = await _voteService.TryHandleVote(updateDto);

            if (voteResponseCode != BotResponseCode.NoAction)
            {
                // Save users that voted.
                await _userService.SaveUser(updateDto.ParsedUser, updateDto.Chat.Id);

                return(voteResponseCode);
            }

            if (IsAddToQueueCallback(updateDto))
            {
                if (updateDto.User == null ||
                    updateDto.Track == null)
                {
                    return(BotResponseCode.CommandRequirementNotFulfilled);
                }

                var spotifyClient = await _spotifyClientFactory.Create(updateDto.User.Id);

                if (spotifyClient == null)
                {
                    var text = $"You didn't connect your Spotify account yet, {updateDto.User.FirstName}. Please connect first.";

                    // TODO: move to commandsservice, get username from telegram me apicall.
                    var url = $"http://t.me/SpotiHenkBot?start={LoginRequestReason.AddToQueue}_{updateDto.Chat.Id}_{updateDto.Track.Id}";

                    await _sendMessageService.AnswerCallbackQuery(updateDto.ParsedUpdateId, text, url);

                    return(BotResponseCode.AddToQueueHandled);
                }

                if (await _spotifyClientService.AddToQueue(spotifyClient, updateDto.Track))
                {
                    await _sendMessageService.AnswerCallbackQuery(updateDto.ParsedUpdateId, "Track added to your queue.");
                }
                else
                {
                    await _sendMessageService.AnswerCallbackQuery(updateDto.ParsedUpdateId, "Could not add track to your queue, play something first!");
                }

                return(BotResponseCode.AddToQueueHandled);
            }

            // This should never happen.
            throw new CallbackQueryNotHandledException();
        }
Пример #22
0
        public async Task UpdateAsync(ObjectId userId, UpdateDto updateDto, CancellationToken cancellationToken)
        {
            var update = Builders <UserDoc> .Update
                         .Set(doc => doc.Username, updateDto.Username)
                         .Set(doc => doc.NormalizedUsername, updateDto.Username.CompareNormalize())
                         .Set(doc => doc.GivenName, updateDto.GivenName)
                         .Set(doc => doc.FamilyName, updateDto.FamilyName);

            await UpdateAsync(userId, update, cancellationToken);
        }
        public async Task <ApiResult <MaterialDto> > UpdateMaterial([FromBody] UpdateDto newMaterial)
        {
            var material = _materialService.UpdateMaterial(newMaterial);

            if (material == null)
            {
                return(await Task.FromResult <ApiResult <MaterialDto> >(NotFound()));
            }
            return(Ok(material));
        }
        public ActionResult <UpdateResult> UpdateStudentProfile(UpdateDto student)
        {
            UpdateResult res = _service.UpdateStudentProfile(student);

            if (res == null)
            {
                return(BadRequest(new { message = " unable to update" }));
            }
            return(Ok(res));
        }
Пример #25
0
        public async Task <bool> UpdateAsync(ObjectId id, UpdateDto updateDto, CancellationToken cancellationToken)
        {
            var update = Builders <EmailTemplateDoc> .Update
                         .Set(x => x.Subject, updateDto.Subject)
                         .Set(x => x.Name, updateDto.Name)
                         .Set(x => x.IsHtml, updateDto.IsHtml)
                         .Set(x => x.Type, updateDto.Type);

            var result = await UpdateAsync(id, update, cancellationToken);

            return(result.MatchedCount == 1);
        }
Пример #26
0
        /// <summary>
        /// Get the VoteType from the update.
        /// </summary>
        /// <returns>The VoteType, or null if no VoteType was found.</returns>
        private VoteType?GetVoteType(UpdateDto updateDto)
        {
            foreach (var voteType in Enum.GetValues(typeof(VoteType)).Cast <VoteType>())
            {
                if (IsVoteCallback(updateDto, voteType))
                {
                    return(voteType);
                }
            }

            return(null);
        }
Пример #27
0
        public async Task <Unit> Handle(PutRequest request, CancellationToken cancellationToken)
        {
            if (await fUserRepository.ExistsByUsernameAsync(request.Model.Username, cancellationToken))
            {
                throw new ConflictException($"User with username '{request.Model.Username}' already exists.");
            }

            var updateDto = new UpdateDto(request.Model.Username, request.Model.GivenName, request.Model.FamilyName);
            await fUserRepository.UpdateAsync(fIdentityService.Current.UserId, updateDto, cancellationToken);

            return(Unit.Value);
        }
Пример #28
0
        public ActionResult UpdateCommand(int id, UpdateDto Updatedto)
        {
            var commandfromRepo = _repository.GetProjectById(id);

            if (commandfromRepo == null)
            {
                return(NotFound());
            }
            _Mappper.Map(Updatedto, commandfromRepo);
            _repository.UpdateCommand(commandfromRepo);
            _repository.SaveChanges();
            return(NoContent());
        }
        public UpdateResult UpdateStudentProfile(UpdateDto student)
        {
            UpdateResult result = null;

            var filter = Builders <Student> .Filter.Eq("Id", student.Id);

            if (student.Photo != null && student.Institute != null)
            {
                var update = Builders <Student> .Update.Set("Photo", student.Photo).Set("Institute", new Institute(student.Institute));

                result = _students.UpdateOne(filter, update);
            }
            else if (student.Photo != null)
            {
                var update = Builders <Student> .Update.Set("Photo", student.Photo);

                result = _students.UpdateOne(filter, update);
            }
            else if (student.Institute != null)
            {
                var update = Builders <Student> .Update.Set("Institute", new Institute(student.Institute));

                result = _students.UpdateOne(filter, update);
            }
            else if (student.Photo != null &&
                     student.Institute != null &&
                     student.LastName != null &&
                     student.FirstName != null
                     )
            {
                var update_1 = Builders <Student> .Update.Set("Photo", student.Photo).Set("Institute", new Institute(student.Institute));

                var update_2 = Builders <User> .Update.Set("LastName", student.LastName).Set("FirstName", student.FirstName);

                Student s = _students.Find(s => s.Id == student.Id).FirstOrDefault();
                _users.UpdateOne(Builders <User> .Filter.Eq("Id", s.user.Id), update_2);
                result = _students.UpdateOne(filter, update_1);
            }
            else if (
                student.LastName != null &&
                student.FirstName != null)
            {
                var update_2 = Builders <User> .Update.Set("LastName", student.LastName).Set("FirstName", student.FirstName);

                Student s = _students.Find(s => s.Id == student.Id).FirstOrDefault();
                result = _users.UpdateOne(Builders <User> .Filter.Eq("Id", s.user.Id), update_2);
            }

            return(result);
        }
Пример #30
0
        public UpdateDto Execute(string Version)
        {
            UpdateDto updateDto = new UpdateDto {
                Message = Messages.NoUpdateRaw
            };
            Update up = unit.Update.GetUpdate(Version);

            if (up != null)
            {
                updateDto.Object = up;
                updateDto.Status = true;
            }
            return(updateDto);
        }