Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,TVChannelId,ShowName")] TVShow tVShow)
        {
            if (id != tVShow.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tVShow);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TVShowExists(tVShow.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TVChannelId"] = new SelectList(_context.TVChannel, "Id", "Id", tVShow.TVChannelId);
            return(View(tVShow));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,SubscriberName,Email")] Subscriber subscriber)
        {
            if (id != subscriber.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(subscriber);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubscriberExists(subscriber.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(subscriber));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ChannelName,Established")] TVChannel tVChannel)
        {
            if (id != tVChannel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tVChannel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TVChannelExists(tVChannel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tVChannel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,SubscriberId,TVShowId,RatingValue")] Rating rating)
        {
            if (id != rating.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rating);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RatingExists(rating.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SubscriberId"] = new SelectList(_context.Subscriber, "Id", "Id", rating.SubscriberId);
            ViewData["TVShowId"]     = new SelectList(_context.Set <TVShow>(), "Id", "Id", rating.TVShowId);
            return(View(rating));
        }