Beispiel #1
0
        private void SaveChanges(object sender, RoutedEventArgs e)
        {
            Genre       currentgenre   = GenreEdit.SelectedItem as Genre;
            GameCompany currentCompany = CompanyEdit.SelectedItem as GameCompany;

            var currentcompanyid = localstore.ReturnGameCompanyId(currentCompany.Name);
            var currentgenreid   = localstore.ReturnGenreId(currentgenre.Name);

            gameforsave.Title            = Title.Text;
            gameforsave.CreatorCompany   = currentCompany;
            gameforsave.CreatorCompanyId = currentcompanyid;
            gameforsave.Price            = float.Parse(Price.Text);
            gameforsave.Rate             = int.Parse(Rating.Value.ToString());
            gameforsave.DateCreated      = DateCreated.SelectedDate.Value;
            gameforsave.Genre            = currentgenre;
            gameforsave.GenreId          = currentgenreid;
            gameforsave.Image            = null;
            try
            {
                localstore.SaveChanges();
                MessageBox.Show("Game edited successfully!");
                this.Close();
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            GameCompany gameCompany = db.GameCompanies.Find(id);

            db.GameCompanies.Remove(gameCompany);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "GameCompanyId,GameCompanyName")] GameCompany gameCompany)
 {
     if (ModelState.IsValid)
     {
         db.Entry(gameCompany).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(gameCompany));
 }
        public Game Get(Guid id)
        {
            var name  = new Name("Name", "Last Name");
            var email = new Email("*****@*****.**");
            var user  = new User(name, email, "username", "password", "password");

            var company = new GameCompany(user, "Company");

            return(new Game(user, "FIFA 19", company));
        }
Beispiel #5
0
        public ActionResult Create([Bind(Include = "GameCompanyId,GameCompanyName")] GameCompany gameCompany)
        {
            if (ModelState.IsValid)
            {
                db.GameCompanies.Add(gameCompany);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(gameCompany));
        }
        private void AddNewGame(object sender, RoutedEventArgs e)
        {
            Genre       currentgenre   = GenreNew.SelectedItem as Genre;
            GameCompany currentCompany = CompanyNew.SelectedItem as GameCompany;

            if (vm.store.isGameAlreadyExisting(Title.Text) == true)
            {
                MessageBox.Show("A game with the same title already exists!");
            }
            else
            {
                if (currentgenre == null || currentCompany == null ||
                    Description.Text == null || Price.Text == null || Price.Text.ToString().All(char.IsDigit) == false ||
                    Rating.Value == null || Title.Text == null)
                {
                    MessageBox.Show("Some of the input data is invalid!");
                }
                else
                {
                    var  currentcompanyid = vm.store.ReturnGameCompanyId(currentCompany.Name);
                    var  currentgenreid   = vm.store.ReturnGenreId(currentgenre.Name);
                    var  imagefrombyte    = BitmapSourceToByteArray((BitmapSource)ImageToImport.Source);
                    Game gametoadd        = new Game()
                    {
                        CreatorCompany   = currentCompany,
                        CreatorCompanyId = currentcompanyid,
                        DateCreated      = DateTime.Parse(DateCreated.Text),
                        Description      = Description.Text,
                        Genre            = currentgenre,
                        GenreId          = currentgenreid,
                        Price            = float.Parse(Price.Text),
                        Rate             = (int)Rating.Value,
                        Title            = Title.Text,
                        Image            = imagefrombyte
                    };

                    gametoadd.CreatorCompany.GamesProduced.Add(gametoadd);
                    gametoadd.Genre.GamesOfGenre.Add(gametoadd);
                    vm.store.AddGame(gametoadd);
                    MessageBox.Show("Game successfully added do database! :)");
                    Description.Text         = String.Empty;
                    Price.Text               = String.Empty;
                    Title.Text               = String.Empty;
                    DateCreated.SelectedDate = DateTime.Now;
                    Rating.Value             = 0;
                    ImageToImport.Source     = null;
                    GenreNew.SelectedValue   = null;
                    CompanyNew.SelectedValue = null;
                }
            }
        }
Beispiel #7
0
        public void ShouldReturnValidWhenITryAGame()
        {
            var name        = new Name("Raphael", "De Pieri");
            var email       = new Email("*****@*****.**");
            var user        = new User(name, email, "teste", "teste1", "teste1");
            var friend      = new Friend(user, name, email, "");
            var gameCompany = new GameCompany(user, "EA SPORTS");

            var game = new Game(user, "FIFA 19", gameCompany);
            var loan = new Loan(friend);

            game.Lend(loan);

            Assert.True(game.Valid);
        }
Beispiel #8
0
        public void ShouldReturnNotificationWhenIReturnIGameButItIsNotLoad()
        {
            var name        = new Name("Raphael", "De Pieri");
            var email       = new Email("*****@*****.**");
            var user        = new User(name, email, "teste", "teste1", "teste1");
            var friend      = new Friend(user, name, email, "");
            var gameCompany = new GameCompany(user, "EA SPORTS");

            var game = new Game(user, "FIFA 19", gameCompany);

            game.Return();

            Assert.True(game.Invalid);
            Assert.Equal(1, game.Notifications.Count);
        }
Beispiel #9
0
        // GET: GameCompanies/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GameCompany gameCompany = db.GameCompanies.Find(id);

            if (gameCompany == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DeveloperSearchResults = db.Games_SelectAllForDeveloper(id).ToList();
            ViewBag.PublisherSearchResults = db.Games_SelectAllForPublisher(id).ToList();
            return(View(gameCompany));
        }
Beispiel #10
0
        public ICommandResult Handle(CreateGameCompanyCommand command)
        {
            var user        = _userRepository.Get(command.UserId);
            var gameCompany = new GameCompany(user, command.Name);

            AddNotifications(gameCompany.Notifications);

            if (Invalid)
            {
                return(new GameCompanyCommandResult(false, "Por favor, corrija os campos abaixo", Notifications));
            }

            _repository.Save(gameCompany);

            return(new GameCompanyCommandResult(true, "Cadastro realizado com sucesso", gameCompany.Id));
        }
Beispiel #11
0
        public void ShouldReturnNotificationWhenITryLoadTheSameGame()
        {
            var name        = new Name("Raphael", "De Pieri");
            var email       = new Email("*****@*****.**");
            var user        = new User(name, email, "teste", "teste1", "teste1");
            var friend      = new Friend(user, name, email, "");
            var gameCompany = new GameCompany(user, "EA SPORTS");

            var game  = new Game(user, "FIFA 19", gameCompany);
            var loan  = new Loan(friend);
            var loan2 = new Loan(friend);

            game.Lend(loan);
            game.Lend(loan2);

            Assert.True(game.Invalid);
            Assert.Equal(1, game.Notifications.Count);
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            UserManager userManager = new UserManager(new MernisCheckManager());
            Customer    customer1   = new Customer();

            customer1.Id             = 1;
            customer1.FirstName      = "Aytuğ";
            customer1.LastName       = "YEŞİLYURT";
            customer1.BirthYear      = new DateTime(1111, 1, 1);
            customer1.NationalNumber = 11111111111;
            customer1.CardNumber     = "1111-1111-1111-1111-1111";
            customer1.UserName       = customer1.FirstName + " " + customer1.LastName;

            userManager.Save(customer1);

            Console.Write("\nOYUN SATIN ALMAK İÇİN BİR TUŞA BASINIZ...");
            Console.ReadLine();


            GamerManager gamerManager = new GamerManager();
            GameCompany  gameCompany1 = new GameCompany();

            gameCompany1.Id           = 1;
            gameCompany1.GameName     = "Red Dead Redemption 2";
            gameCompany1.GameCategory = "Aksiyon, Savaş, Cinsellik";
            gameCompany1.ReleaseDate  = new DateTime(2018, 10, 26);
            gameCompany1.CompanyName  = "ROCKSTAR GAMES";
            GameCompany gameCompany2 = new GameCompany();

            gameCompany2.GameName = "GTA V";
            GameCompany gameCompany3 = new GameCompany();

            gameCompany3.GameName = "L.A. Noire";

            CampaignManager campaignManager = new CampaignManager();

            gamerManager.Buy(gameCompany1, customer1);
            Console.Write("\nOYUN İNDİRİMİ ALMAK İÇİN BİR TUŞA BASINIZ...");
            Console.ReadLine();
            campaignManager.SummerSale(gameCompany1, gameCompany2, gameCompany3);


            Console.ReadLine();
        }
Beispiel #13
0
 // GET: GameCompanies/Edit/5
 public ActionResult Edit(int?id)
 {
     if (this.User.Identity.IsAuthenticated)
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         GameCompany gameCompany = db.GameCompanies.Find(id);
         if (gameCompany == null)
         {
             return(HttpNotFound());
         }
         return(View(gameCompany));
     }
     else
     {
         return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
     }
 }
Beispiel #14
0
        private void ExportJSON(object sender, RoutedEventArgs e)
        {
            var json = JsonConvert.SerializeObject(gamesforexport.Select(x => new
            {
                Name      = x.Title,
                Price     = x.Price,
                Rating    = x.Rate,
                CreatedBy = x.CreatorCompany.Name,
                Genre     = x.Genre.Name
            }), Formatting.Indented);
            GameCompany companynameexport = (GameCompany)CompanyBox.SelectedItem;

            try
            {
                File.WriteAllText($"../../Exports/games-by-{companynameexport.Name}.json", json);
                MessageBox.Show("Successfully exported your games! Look in Exports folder :)");
            }
            catch (Exception exc)
            {
                MessageBox.Show("Oops! Something went wrong :(");
            }
        }
 public void Delete(GameCompany gameCompany)
 {
     Console.WriteLine("Kampanya güncellendi");
 }
Beispiel #16
0
 public void Save(GameCompany gameCompany)
 {
     _context.GameCompanies.Add(gameCompany);
 }
Beispiel #17
0
        static void Main(string[] args)
        {
            //Adding companies and games to the databases
            GameCompanyData db = new GameCompanyData();

            using (db)
            {
                GameCompany c1 = new GameCompany()
                {
                    CompanyID = 1, CompanyName = "Square Enix", Founded = 1975, CompanyImage = "https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Square_Enix_logo.svg/1200px-Square_Enix_logo.svg.png"
                };
                GameCompany c2 = new GameCompany()
                {
                    CompanyID = 2, CompanyName = "Bethesda", Founded = 1986, CompanyImage = "https://upload.wikimedia.org/wikipedia/commons/thumb/2/22/Bethesda_Game_Studios_logo.svg/1200px-Bethesda_Game_Studios_logo.svg.png"
                };
                GameCompany c3 = new GameCompany()
                {
                    CompanyID = 3, CompanyName = "Atlus", Founded = 1986, CompanyImage = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/19/Atlus_logo_%282014%29.svg/1200px-Atlus_logo_%282014%29.svg.png"
                };
                GameCompany c4 = new GameCompany()
                {
                    CompanyID = 4, CompanyName = "Nintendo", Founded = 1889, CompanyImage = "https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/d2a7fa0d-5fd4-4d4d-a4c9-c673b80862d4/dbjyfvc-82c7a4e1-e499-4b97-9c60-aa94b16b4753.png/v1/fill/w_1024,h_387,strp/nintendo_logo_transparent_by_epycwyn_dbjyfvc-fullview.png?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOiIsImlzcyI6InVybjphcHA6Iiwib2JqIjpbW3siaGVpZ2h0IjoiPD0zODciLCJwYXRoIjoiXC9mXC9kMmE3ZmEwZC01ZmQ0LTRkNGQtYTRjOS1jNjczYjgwODYyZDRcL2RianlmdmMtODJjN2E0ZTEtZTQ5OS00Yjk3LTljNjAtYWE5NGIxNmI0NzUzLnBuZyIsIndpZHRoIjoiPD0xMDI0In1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmltYWdlLm9wZXJhdGlvbnMiXX0.N-YrJ7G3oEIZPVQpwzJS0y6Dp_-wLnQMk3LWV--Obpk"
                };

                VideoGame g1 = new VideoGame()
                {
                    GameID = 1, GameName = "Final Fantasy VII", GameRelease = 1997, CompanyID = 1, GameCompany = c1, GameImage = "https://s1.gaming-cdn.com/images/products/1683/orig/final-fantasy-vii-cover.jpg"
                };
                VideoGame g2 = new VideoGame()
                {
                    GameID = 2, GameName = "Dragon Quest XI", GameRelease = 2017, CompanyID = 1, GameCompany = c1, GameImage = "https://upload.wikimedia.org/wikipedia/en/4/4c/Dragon_Quest_XI_cover_art.jpg"
                };
                VideoGame g3 = new VideoGame()
                {
                    GameID = 3, GameName = "Nier Automata", GameRelease = 2017, CompanyID = 1, GameCompany = c1, GameImage = "https://www.mobygames.com/images/covers/l/623192-nier-automata-game-of-the-yorha-edition-playstation-4-front-cover.png"
                };

                VideoGame g4 = new VideoGame()
                {
                    GameID = 4, GameName = "Skyrim", GameRelease = 2011, CompanyID = 2, GameCompany = c2, GameImage = "https://upload.wikimedia.org/wikipedia/en/1/15/The_Elder_Scrolls_V_Skyrim_cover.png"
                };
                VideoGame g5 = new VideoGame()
                {
                    GameID = 5, GameName = "Doom Eternal", GameRelease = 2020, CompanyID = 2, GameCompany = c2, GameImage = "https://upload.wikimedia.org/wikipedia/en/9/9d/Cover_Art_of_Doom_Eternal.png"
                };
                VideoGame g6 = new VideoGame()
                {
                    GameID = 6, GameName = "Fallout: New Vegas", GameRelease = 2010, CompanyID = 2, GameCompany = c2, GameImage = "https://static.wikia.nocookie.net/fallout/images/f/ff/FNV_box_art_%28US%29.jpg/revision/latest?cb=20150327233343"
                };

                VideoGame g7 = new VideoGame()
                {
                    GameID = 7, GameName = "Persona 5 Royal", GameRelease = 2019, CompanyID = 3, GameCompany = c3, GameImage = "https://www.mobygames.com/images/covers/l/636447-persona-5-royal-playstation-4-front-cover.jpg"
                };
                VideoGame g8 = new VideoGame()
                {
                    GameID = 8, GameName = "Shin Megami Tensei Nocturne: III", GameRelease = 2003, CompanyID = 3, GameCompany = c3, GameImage = "https://upload.wikimedia.org/wikipedia/en/7/7c/Shin_Megami_Tensei_Nocturne_NA_cover.png"
                };
                VideoGame g9 = new VideoGame()
                {
                    GameID = 9, GameName = "Persona 4 Golden", GameRelease = 2012, CompanyID = 3, GameCompany = c3, GameImage = "https://gbatemp.net/data/reviews/boxart/full/1426.jpg?1592731478"
                };

                VideoGame g10 = new VideoGame()
                {
                    GameID = 10, GameName = "Super Smash Bros. Melee", GameRelease = 2001, CompanyID = 4, GameCompany = c4, GameImage = "https://upload.wikimedia.org/wikipedia/en/7/75/Super_Smash_Bros_Melee_box_art.png"
                };
                VideoGame g11 = new VideoGame()
                {
                    GameID = 11, GameName = "Rhythm Heaven Fever", GameRelease = 2011, CompanyID = 4, GameCompany = c4, GameImage = "https://upload.wikimedia.org/wikipedia/en/thumb/b/bb/Rhythm-heaven-fever.jpg/220px-Rhythm-heaven-fever.jpg"
                };
                VideoGame g12 = new VideoGame()
                {
                    GameID = 12, GameName = "Super Mario Odyssey", GameRelease = 2017, CompanyID = 4, GameCompany = c4, GameImage = "https://static-ie.gamestop.ie/images/products/257778/3max.jpg"
                };

                db.GameCompanies.Add(c1);
                db.GameCompanies.Add(c2);
                db.GameCompanies.Add(c3);
                db.GameCompanies.Add(c4);
                Console.WriteLine("Added Game Companies to db");

                db.VideoGames.Add(g1);
                db.VideoGames.Add(g2);
                db.VideoGames.Add(g3);
                db.VideoGames.Add(g4);
                db.VideoGames.Add(g5);
                db.VideoGames.Add(g6);
                db.VideoGames.Add(g7);
                db.VideoGames.Add(g8);
                db.VideoGames.Add(g9);
                db.VideoGames.Add(g10);
                db.VideoGames.Add(g11);
                db.VideoGames.Add(g12);
                Console.WriteLine("Added Video Games to db");

                db.SaveChanges();
                Console.WriteLine("Saved all to db");
            }
        }
 public void Update(GameCompany gameCompany)
 {
     Console.WriteLine("Kampanya silindi");
 }
 public void Add(GameCompany gameCompany)
 {
     Console.WriteLine("Kampanya eklendi");
 }
Beispiel #20
0
 public void Save(GameCompany gameCompany)
 {
 }