private async Task PageChanged(PageDto pageDto, string primaryText, string webBody)
        {
            string text = pageDto.HighAccuracy ?
                          _differenceService.GetDifference(primaryText, webBody, pageDto.CheckingType) :
                          _differenceService.GetPatches(primaryText, webBody, pageDto.CheckingType);

            await _pageDifferenceService.AddDifference(new AddDifferenceDto
            {
                Text   = text,
                PageId = pageDto.PageId
            });

            await _websiteTextService.EditText(pageDto.PrimaryTextId, webBody);

            pageDto.HasChanged = true;
            pageDto.Stopped    = true;
            await _pageService.EditPage(pageDto);

            var user = await _userService.GetUser(pageDto.UserId);

            //notification
            var message = CreateNotificationMessage(user, pageDto);

            _emailService.SendEmail(message);

            StopPageChangeChecking(pageDto.PageId.ToString());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddDifference([FromBody] AddDifferenceDto differenceDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var diff = await _pageDifferenceService.AddDifference(differenceDto);

            if (diff == null)
            {
                return(BadRequest());
            }

            return(Ok(diff));
        }