Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Director,Producer")] Kids_Collection kids_Collection)
        {
            if (id != kids_Collection.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(kids_Collection);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Kids_CollectionExists(kids_Collection.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(kids_Collection));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Director,Producer")] Kids_Collection kids_Collection)
        {
            if (ModelState.IsValid)
            {
                _context.Add(kids_Collection);
                await _context.SaveChangesAsync();

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