Ejemplo n.º 1
0
        public async Task <IActionResult> EditVideo(int?id, NoticeVideo _video, IFormFile File)
        {
            if (id == null)
            {
                return(NotFound());
            }
            NoticeVideo video = await _db.NoticeVideos.FindAsync(id);

            if (video == null)
            {
                return(NotFound());
            }

            if (File != null)
            {
                if (!File.isImage())
                {
                    ModelState.AddModelError(string.Empty, "Choose Photo");
                    return(View(_video));
                }
                Helpers.Helper.DeleteIMG(_env.WebRootPath, "img/notice", video.Image);
                video.Image = await File.SaveImg(_env.WebRootPath, "img/notice");
            }


            video.Link = _video.Link;
            await _db.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> EditVideo(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            NoticeVideo video = await _db.NoticeVideos.FindAsync(id);

            if (video == null)
            {
                return(NotFound());
            }
            return(View(video));
        }