public IActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var format = _context.GetFormatByID(id);

            if (format == null)
            {
                return(NotFound());
            }
            var games = _context.GetAllGames();

            var viewModel = new FormatFormViewModel
            {
                FormatID          = id,
                FormatName        = format.FormatName,
                FormatDescription = format.FormatDescription,
                FormatLink        = format.FormatLink,
                GameID            = format.GameID,
                Games             = games
            };

            return(View(viewModel));
        }
        // GET: Formats/Create
        public IActionResult Create()
        {
            var games = _context.GetAllGames();

            var viewModel = new FormatFormViewModel
            {
                Games = games
            };

            return(View(viewModel));
        }
Example #3
0
        public void EditFormatView(FormatFormViewModel viewModel)
        {
            Format format = new Format();

            format.FormatName        = viewModel.FormatName;
            format.FormatLink        = viewModel.FormatLink;
            format.FormatDescription = viewModel.FormatDescription;
            format.GameID            = format.GameID;

            EditFormat(format);
        }