Beispiel #1
0
        public GamesEntity GamesCreate(GamesEntity game)
        {
            _context.Games.Add(game);
            _context.SaveChanges();

            return(game);
        }
Beispiel #2
0
        public async Task <GamesViewModel> Post(JObject json)
        {
            _invillaContext = new InvillaContext();

            try
            {
                var modelo = JsonConvert.DeserializeObject <GamesViewModel>(json.ToString());
                modelo.RegistrationDate = DateTime.Now;
                var Games = new GamesEntity
                {
                    FullGameName     = modelo.FullGameName,
                    RegistrationDate = modelo.RegistrationDate
                };
                _invillaContext.Add(Games);
                _invillaContext.SaveChanges();

                return(modelo);
            }
            catch (Exception ex)
            {
                return(new GamesViewModel
                {
                });
            }
        }
Beispiel #3
0
        public async Task <GamesGetByIdResponseDTO> GamesGetById(int id)
        {
            GamesEntity gameGetByIdRepositoryResponse = await _gamesRepository.GamesGetById(id);

            return(new GamesGetByIdResponseDTO
            {
                GameReturned = gameGetByIdRepositoryResponse
            });
        }
Beispiel #4
0
        public GamesEntity GamesUpdate(int id, GamesEntity game)
        {
            var entity = _context.Games.Find(id);

            entity.Stadium  = game.Stadium;
            entity.TeamAway = game.TeamAway;
            entity.TeamHome = game.TeamHome;
            _context.SaveChanges();

            return(entity);
        }
Beispiel #5
0
        public GamesUpdateResponseDTO GamesUpdate(int id, GamesUpdateRequestDTO gamesUpdateRequestDTO)
        {
            var gamesEntity = new GamesEntity
            {
                TeamAway = gamesUpdateRequestDTO.TeamAway,
                TeamHome = gamesUpdateRequestDTO.TeamHome,
                Stadium  = gamesUpdateRequestDTO.Stadium
            };

            GamesEntity gamesUpdatedRepositoryResponse = _gamesRepository.GamesUpdate(id, gamesEntity);

            return(new GamesUpdateResponseDTO
            {
                GameUpdated = gamesUpdatedRepositoryResponse
            });
        }
Beispiel #6
0
        public GamesCreateResponseDTO GamesCreate(GamesCreateRequestDTO gamesCreateRequestDTO)
        {
            var gamesEntity = new GamesEntity
            {
                TeamAway = gamesCreateRequestDTO.TeamAway,
                TeamHome = gamesCreateRequestDTO.TeamHome,
                Stadium  = gamesCreateRequestDTO.Stadium
            };

            GamesEntity gamesRepositoryResponse = _gamesRepository.GamesCreate(gamesEntity);

            return(new GamesCreateResponseDTO
            {
                ReturnedGame = gamesRepositoryResponse
            });
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            CustormerEntitys custormerEntitys = new CustormerEntitys()
            {
                Nidentity = "1",
                Name      = "Tolgahan",
                Surname   = "Erbabi",
                BirthYear = 1996
            };

            GameSellManager gameSellManager = new GameSellManager();

            UserValiditionService userValiditionService = new UserValiditionService();
            GamesEntity           fifa21 = new GamesEntity();

            fifa21.Name  = "Fifa 21";
            fifa21.Price = 350;

            GamesEntity pes21 = new GamesEntity();

            pes21.Name  = "Pes 21";
            pes21.Price = 100;

            GamesEntity nba2k21 = new GamesEntity();

            nba2k21.Name  = "Nba 2k 21";
            nba2k21.Price = 250;

            CustomerManager customerManager = new CustomerManager(userValiditionService);

            customerManager.Register(custormerEntitys);

            ISaleManager newAccountSale = new NewAccountSale();
            ISaleManager newYearSale    = new NewYearSale();

            newAccountSale.Sale(nba2k21);
            gameSellManager.Sell(custormerEntitys, nba2k21);
        }