Example #1
0
        public async Task <ActionResult <Show> > CreatedShow(NewShow vm)
        {
            var db    = new DatabaseContext();
            var venue = db.Venues
                        .FirstOrDefault(venue => venue.Id == vm.VenueId);

            if (venue == null)
            {
                return(NotFound());
            }
            else
            {
                var show = new Show
                {
                    EventName   = vm.EventName,
                    DateOfEvent = vm.DateOfEvent,
                    VenueId     = vm.VenueId
                };
                db.Shows.Add(show);
                db.SaveChanges();
                var rv = new CreatedShow
                {
                    Id          = show.Id,
                    EventName   = show.EventName,
                    DateOfEvent = show.DateOfEvent,
                    VenueId     = show.VenueId
                };
                return(Ok(rv));
            }
        }
Example #2
0
        async public Task <IResult <NewShow> > GetNewShows(int Page = 1)
        {
            IResult <NewShow> Donut = null;
            var Liste = new NewShow();

            var Req = new RestRequest("listeler/eklenen/sayfa-" + Page.ToString());
            var Res = this._HttpClient.Get(Req);

            if (Res.StatusCode != System.Net.HttpStatusCode.OK)
            {
                Donut = Result.Fail <NewShow>(Res.StatusDescription);
            }
            else
            {
                TextInfo ti       = CultureInfo.CurrentCulture.TextInfo;
                Regex    Onlyizle = new Regex(@"(.*?) izle");

                var Document = await Res.Content.ConvertHTML();

                var AnimelerHTMLS = Document.QuerySelectorAll(".flx-block");


                foreach (var AnimeHTML in AnimelerHTMLS)
                {
                    ShortShow ShortShow = new ShortShow();
                    ShortShow.Uri   = AnimeHTML.Attributes["data-href"].Value;
                    ShortShow.Image = AnimeHTML.QuerySelector("a>img").Attributes["src"].Value;
                    ShortShow.Name  = AnimeHTML.QuerySelector(".bar>h4").Text();

                    var TestIzle = Onlyizle.Match(ShortShow.Name.ToLower());
                    if (TestIzle.Success)
                    {
                        ShortShow.ShowName = ti.ToTitleCase(TestIzle.Groups[1].Value);
                    }
                    else
                    {
                        ShortShow.ShowName = ShortShow.Name;
                    }

                    Liste.Shows.Add(ShortShow);
                }


                var PaginationHtml = Document.QuerySelectorAll(".pagination")[0];

                Liste.Pagination.Current = Convert.ToInt32(PaginationHtml.QuerySelector(".active").Text());

                Liste.Pagination.Max = Convert.ToInt32(PaginationHtml.QuerySelectorAll("li")[PaginationHtml.QuerySelectorAll("li").Length - 2].Text());

                Donut = Result.Success(Liste);
            }

            return(Donut);
        }
Example #3
0
    public void AddShow(NewShow a)
    {
        Show show = new Show();

        show.ShowKey         = a.ShowKey;
        show.ShowName        = a.ShowName;
        show.ShowDate        = a.ShowDate;
        show.ShowDateEntered = DateTime.Now;
        show.ShowTime        = a.ShowTime;
        show.ShowTicketInfo  = a.ShowTicketInfo;
        show.VenueKey        = a.VenueKey;

        db.Shows.Add(show);
        db.SaveChanges();
    }
Example #4
0
 private void OnNewShow()
 {
     NewShow?.Invoke(this, EventArgs.Empty);
 }