Example #1
0
        public string EditGame(NewGameBindingModel editGameBm)
        {
            if (!NewGameValidator.IsValidGame(editGameBm))
            {
                return("/catalog/AllGames");
            }

            var game = this.games.GetById(editGameBm.GameId);

            game.Description    = editGameBm.Description;
            game.Size           = editGameBm.Size;
            game.Title          = editGameBm.Title;
            game.Price          = editGameBm.Price;
            game.ImageThumbnail = editGameBm.Thumbnail;
            game.Trailer        = editGameBm.Trailer;

            this.games.SaveChanges();

            return("/home/all");
        }
Example #2
0
        public string AddNewGame(NewGameBindingModel newGameBm)
        {
            if (!NewGameValidator.IsValidGame(newGameBm))
            {
                return("/catalog/AddGame");
            }

            var game = new Game()
            {
                Title          = newGameBm.Title,
                Price          = newGameBm.Price,
                Size           = newGameBm.Size,
                Description    = newGameBm.Description,
                ImageThumbnail = newGameBm.Thumbnail,
                Trailer        = newGameBm.Trailer
            };

            this.games.Add(game);
            this.games.SaveChanges();

            return("/home/all");
        }