示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Rank,Title,Weekend,Gross,Week")] TopBoxOffice topBoxOffice)
        {
            if (id != topBoxOffice.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(topBoxOffice);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TopBoxOfficeExists(topBoxOffice.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(topBoxOffice));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Rank,Title,Weekend,Gross,Week")] TopBoxOffice topBoxOffice)
        {
            if (ModelState.IsValid)
            {
                _context.Add(topBoxOffice);
                await _context.SaveChangesAsync();

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