public async Task <IActionResult> Edit(int id, [Bind("Id,Title,LatestReleaseDate,Genre,Complexity,Price")] UberCategory uberCategory)
        {
            if (id != uberCategory.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(uberCategory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UberCategoryExists(uberCategory.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(uberCategory));
        }
        public async Task <IActionResult> Create([Bind("Id,Title,LatestReleaseDate,Genre,Complexity,Price")] UberCategory uberCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(uberCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(uberCategory));
        }
Example #3
0
 public IViewComponentResult Invoke(UberCategory uberCategory)
 {
     return(View(_context.Topic
                 .Where(x => x.UberCategoryId == uberCategory.Id)));
 }