public ActionResult <List <Announce> > Scrap(ScrapParametersDto scrapParametersDto) { var scrapedAnnounces = _scrapService.Scrap(scrapParametersDto); var dbAnnounces = _announceService.Get(null, (PaginationFilter)null); var newAnnounces = _streetParser.ParseStreet(_scrapService.GetOnlyNewAnnounces(dbAnnounces, scrapedAnnounces)).ToList(); foreach (var newAnnounce in newAnnounces) { _announceService.Create(newAnnounce); } return(newAnnounces); }
public async Task <ActionResult <AnnounceForReturnDto> > Create([FromBody] AnnounceForCreationDto creationDto) { var announce = await announceService.Create(creationDto); var connIds = await userTracker.GetOnlineUser(); if (connIds != null && connIds.Length != 0) { await hubContext.Clients.GroupExcept("Announce", connIds).SendAsync("ReceiveNewAnnounce", announce, true); } return(announce); }