コード例 #1
0
        public async Task SubmitAnimeFullAsync(AnimeSubmissionInputModel model, string userId, string submissionType)
        {
            var user = await this.userManager.FindByIdAsync(userId);

            var animeSubmission = new AnimeSubmission()
            {
                SubmitterId     = userId,
                Submitter       = user,
                SubmissionType  = submissionType,
                Title           = model.Title,
                Genres          = string.Join(", ", model.Genres),
                Picture         = model.PictureUrl,
                Type            = model.Type,
                Synopsis        = model.Synopsis,
                Episodes        = model.Episodes.ToString(),
                Status          = string.Join(" ", model.Status),
                Aired           = model.Aired,
                Trailer         = model.Trailer,
                Synonyms        = model.Synonyms,
                EpisodeDuration = model.Duration.ToString(),
                Rating          = model.Rating,
                Studios         = model.Studio, // Maybe change in in the model to studio
            };

            await this.asubRepo.AddAsync(animeSubmission);

            await this.asubRepo.SaveChangesAsync();
        }
コード例 #2
0
        public async Task SubmitAnimeWithUrlAsync(string url, string userId)
        {
            var user = await this.userManager.FindByIdAsync(userId);

            var urlSubmission = new AnimeSubmission()
            {
                SubmitterId    = userId,
                SubmissionUrl  = url,
                SubmissionType = "Url",
                Submitter      = user,
            };

            await this.asubRepo.AddAsync(urlSubmission);
        }