Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("id,Video")] AboutVideo aboutVideo)
        {
            if (id != aboutVideo.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(aboutVideo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AboutVideoExists(aboutVideo.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(aboutVideo));
        }
Esempio n. 2
0
        public async Task <IActionResult> Index()
        {
            AboutWelcome          aboutWelcome = _db.AboutWelcomes.FirstOrDefault();
            ICollection <Teacher> teachers     = await _db.Teachers.Include(t => t.TeacherContact).Take(4).ToListAsync();

            AboutSlider aboutSlider = await _db.AboutSliders.FirstOrDefaultAsync();

            AboutVideo aboutVideo = await _db.AboutVideos.FirstOrDefaultAsync();

            ICollection <AboutNotice> aboutNotices = await _db.AboutNotices.Take(6).ToListAsync();

            Bio bio = await _db.Bios.FirstOrDefaultAsync();

            AboutVM aboutVM = new AboutVM()
            {
                AboutWelcome = aboutWelcome,
                Teachers     = teachers,
                Bio          = bio,
                AboutSlider  = aboutSlider,
                AboutVideo   = aboutVideo,
                AboutNotices = aboutNotices
            };

            return(View(aboutVM));
        }
        public async Task <IActionResult> Create([Bind("Id,Title,Youtube,IsDeleted,TimeDeleted")] AboutVideo aboutVideo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(aboutVideo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(aboutVideo));
        }
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            AboutVideo FindvideoLinkt = await _db.AboutVideos.FindAsync(id);

            if (FindvideoLinkt == null)
            {
                return(NotFound());
            }
            return(View(FindvideoLinkt));
        }
Esempio n. 5
0
        public async Task <IActionResult> Index()
        {
            ICollection <HomeSlider> homeSliders = await _db.HomeSliders.ToListAsync();

            ICollection <Course> courses = await _db.Courses.Take(3).ToListAsync();

            ICollection <AboutNotice> aboutNotices = await _db.AboutNotices.Take(5).ToListAsync();

            ICollection <Event> events = await _db.Events.Take(4).ToListAsync();

            AboutSlider aboutSliders = await _db.AboutSliders.FirstOrDefaultAsync();

            ICollection <Blog> blogs = await _db.Blogs.Take(3).ToListAsync();

            AboutVideo aboutVideo = await _db.AboutVideos.FirstOrDefaultAsync();

            ICollection <AppUser> appUser = await _userManager.Users.ToListAsync();

            AboutWelcome aboutWelcome = await _db.AboutWelcomes.FirstOrDefaultAsync();

            Bio bio = await _db.Bios.FirstOrDefaultAsync();

            HomeVM homeVM = new HomeVM()
            {
                HomeSliders  = homeSliders,
                AboutWelcome = aboutWelcome,
                Courses      = courses,
                AboutVideo   = aboutVideo,
                AboutNotices = aboutNotices,
                AboutSliders = aboutSliders,
                Events       = events,
                AppUser      = appUser,
                Blogs        = blogs,
                Bio          = bio
            };

            return(View(homeVM));
        }
        public async Task <IActionResult> Edit(int?id, AboutVideo aboutVideo)
        {
            AboutVideo FindvideoLinkt = await _db.AboutVideos.FindAsync(id);

            if (!ModelState.IsValid)
            {
                return(View(FindvideoLinkt));
            }
            if (aboutVideo.VideoLink == null)
            {
                ModelState.AddModelError("", "Zehmet olmasa link daxil edin");
                return(View(FindvideoLinkt));
            }
            if (id == null)
            {
                return(NotFound());
            }


            FindvideoLinkt.VideoLink = aboutVideo.VideoLink;
            await _db.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }