Ejemplo n.º 1
0
        private async Task SendLocalisedRantNotifications(RantDomain rant)
        {
            RantDomain rantToNotify = await _rantManager.GetRantByNumber(rant.Number);

            //NewRantToast newrantToast = new NewRantToast(rantToNotify.Title, rantToNotify.Url, rantToNotify.Author, locale);
            //await SendTemplateNotificationAsync(newrantToast.Toast, locale);
        }
Ejemplo n.º 2
0
        public async Task <RantDomain> CreateAsync(RantDomain rantDomain)
        {
            RantEntity rantEntity           = Mapper.Map <RantEntity>(rantDomain);
            EntityEntry <RantEntity> entity = await DbSet.AddAsync(rantEntity);

            return(Mapper.Map <RantDomain>(entity.Entity));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetRant(int number)
        {
            try
            {
                RantDomain rant = await _mediator.Send(new GetRantQuery(number));

                return(Ok(rant));
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 4
0
        public static List <RantDomain> Parse(int stripNumber, int stripNumberMax)
        {
            List <RantDomain> rants = new();
            HtmlWeb           web   = new();

            for (int index = stripNumber; index <= stripNumberMax; index++)
            {
                HtmlDocument       htmlDoc = web.Load(new Uri("https://megatokyo.com/strip/" + index.ToString(CultureInfo.InvariantCulture)));
                HtmlNodeCollection nodes   = htmlDoc.DocumentNode.SelectNodes("//div[contains(@id,'rant')]");
                foreach (HtmlNode node in nodes)
                {
                    RantDomain rant = ExtractRant(node, rants);
                    if (rant != null)
                    {
                        rants.Add(rant);
                        Debug.WriteLine("Rant " + rant.Number.ToString(CultureInfo.InvariantCulture) + " - " + rant.Title);
                    }
                }
            }
            return(rants);
        }