Ejemplo n.º 1
0
    public async void GetLink(MediaEdit _mediaEdit, int _index, Action <Files> _callback)
    {
        await new WaitUntil(() =>
        {
            return(enableCompited);
        });
        var AM = AppManager.Instance;

        Debug.Log("recieved index = " + _index);
        editIndex = _index;
        callback  = _callback;
        mediaEdit = _mediaEdit;
    }//ссылки для префабов
Ejemplo n.º 2
0
        public IHttpActionResult Put(MediaEdit media)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateMediaService();

            if (!service.UpdateMedia(media))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Ejemplo n.º 3
0
        public bool UpdateMedia(MediaEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity = ctx
                             .Media.Single(e => e.MediaId == model.MediaId);

                entity.MediaId       = model.MediaId;
                entity.Title         = model.Title;
                entity.Genre         = (Genre)model.Genre;
                entity.MediaType     = (MediaType)model.MediaType;
                entity.SeasonEpisode = model.SeasonEpisode;
                entity.SceneOfFood   = entity.SceneOfFood;
                entity.ModifiedUtc   = DateTimeOffset.UtcNow;

                return(ctx.SaveChanges() == 1);
            }
        }
Ejemplo n.º 4
0
        public async Task ApplyEditForApproval(MediaDetailsInputModel edit, string userId, string rootPath)
        {
            var mediaEdit = new MediaEdit()
            {
                Title             = edit.Title,
                MediaId           = edit.Id,
                Overview          = edit.Overview,
                Language          = edit.Language,
                IsDetailFull      = true,
                ReleaseDate       = edit.ReleaseDate,
                Runtime           = edit.Runtime,
                Budget            = edit.Budget,
                YoutubeTrailerUrl = edit.YoutubeTrailerUrl,
                KeywordsJson      = edit.Keywords,
                Genres            = edit.Genres,
                CreatorId         = userId,
                MediaType         = edit.MediaType,
            };

            var image = edit.PosterImageFile;

            if (image != null)
            {
                var tempPath = GlobalConstants.TemporaryImagesDir;
                var path     = rootPath + tempPath;

                var name           = "tempPoster-" + mediaEdit.Id;
                var imageExtension = await FileDownloader.DownloadImage(image, path, name);

                mediaEdit.PosterPath = tempPath + $"{name}.{imageExtension}";
            }
            else
            {
                mediaEdit.PosterPath = edit.PosterPath;
            }

            await this.mediaEditRepo.AddAsync(mediaEdit);

            await this.mediaEditRepo.SaveChangesAsync();
        }