示例#1
0
        public void DeleteTest()
        {
            var firstCampaign = _db.Campaigns.First();

            _service.Delete(firstCampaign);
            Assert.False(_service.Exists(firstCampaign.Id));
        }
示例#2
0
 public IHttpActionResult Delete(Dictionary <string, object> SearchData)
 {
     try
     {
         using (CampaignService obj = new CampaignService())
             return(Ok(obj.Delete(SearchData)));
     }
     catch (Exception Ex)
     {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, Ex.Message.ToString())));
     }
 }
 public void RemoveCampaign(int id)
 {
     try
     {
         CampaignService.Delete(id);
     }
     catch (Exception)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
         {
             Content      = new StringContent("An error occurred, please try again or contact the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
 }
示例#4
0
        static void Main(string[] args)
        {
            #region InnerClass

            List <Player>   playerList   = new List <Player>();
            List <Campaign> campaignList = new List <Campaign>();

            while (true)
            {
                var process = Intro();

                switch (process)
                {
                case 1:
                    //oyuncu ekle
                    PlayerService playerServiceAdd = new PlayerService();
                    playerServiceAdd.Add(playerList);

                    break;

                case 2:
                    //oyuncu güncelle
                    PlayerService playerServiceUpdate = new PlayerService();
                    playerServiceUpdate.Update(playerList);
                    break;

                case 3:
                    //oyuncu sil
                    PlayerService playerServiceDelete = new PlayerService();
                    playerServiceDelete.Delete(playerList);
                    break;

                case 4:
                    //kampanya ekle
                    CampaignService campaignServiceAdd = new CampaignService();
                    campaignServiceAdd.Add(campaignList);
                    break;

                case 5:
                    //kampanya güncelle
                    CampaignService campaignServiceUpdate = new CampaignService();
                    campaignServiceUpdate.Update(campaignList);

                    break;

                case 6:
                    //kampanya sil
                    CampaignService campaignServiceDelete = new CampaignService();
                    campaignServiceDelete.Delete(campaignList);

                    break;

                case 7:
                    //oyun satın al
                    GameService gameServiceBuy = new GameService();
                    gameServiceBuy.Buy(playerList, campaignList);
                    break;

                case 8:
                    //oyuncuları listele
                    Console.WriteLine("---Oyuncular---");
                    foreach (var player in playerList)
                    {
                        Console.WriteLine("----------------------");
                        Console.WriteLine(player.PlayerTcNo);
                        Console.WriteLine(player.PlayerFirstName);
                        Console.WriteLine(player.PlayerLastName);
                        Console.WriteLine(player.PlayerBirthOfYear);
                    }
                    break;

                case 9:
                    //kampanyaları listele
                    Console.WriteLine("---Kampanyalar---");
                    foreach (var campaign in campaignList)
                    {
                        Console.WriteLine("----------------------");
                        Console.WriteLine(campaign.CampaignName);
                        Console.WriteLine(campaign.CampaignDiscount);
                    }
                    break;

                case 10:
                    //oyunları listele
                    GameService gameService = new GameService();
                    Console.WriteLine("---Oyunlar---");
                    foreach (var game in gameService.games)
                    {
                        Console.WriteLine("----------------------");
                        Console.WriteLine(game.GameName);
                        Console.WriteLine(game.GameType);
                        Console.WriteLine(game.GamePlatform);
                        Console.WriteLine(game.GamePrice);
                    }
                    break;
                }
            }

            #endregion
        }
示例#5
0
        static void Main(string[] args)
        {
            //Oyuncular
            Gamer gamer1 = new Gamer();

            gamer1.GamerId       = 1;
            gamer1.FirstName     = "merve";
            gamer1.LastName      = "aydın";
            gamer1.NationalityId = "12345";
            gamer1.DateOfBirth   = new DateTime(1992, 10, 10);

            Gamer gamer2 = new Gamer();

            gamer2.GamerId       = 2;
            gamer2.FirstName     = "ferhat";
            gamer2.LastName      = "aydın";
            gamer2.NationalityId = "123456";
            gamer2.DateOfBirth   = new DateTime(1985, 2, 1);

            Gamer gamer3 = new Gamer();

            gamer3.GamerId       = 3;
            gamer3.FirstName     = "esra";
            gamer3.LastName      = "aydın";
            gamer3.NationalityId = "1234567";
            gamer3.DateOfBirth   = new DateTime(1995, 1, 1);


            //Kampanyalar
            Campaign campaign1 = new Campaign();

            campaign1.CampaignId    = 10;
            campaign1.CampaignName  = "kış ";
            campaign1.CampaignValue = "%5";

            Campaign campaign2 = new Campaign();

            campaign2.CampaignId    = 11;
            campaign2.CampaignName  = "tatil  ";
            campaign2.CampaignValue = "%10";

            Campaign campaign3 = new Campaign();

            campaign3.CampaignId    = 12;
            campaign3.CampaignName  = "yaz ";
            campaign3.CampaignValue = "%15";

            //Oyunlar

            Game game1 = new Game();

            game1.GameId    = 5;
            game1.GameName  = "tetris";
            game1.GamePrice = 100.0;

            IGamerService gamerService = new GamerManager(new GamerCheckManager());

            gamerService.Save(gamer1);
            gamerService.Update(gamer2);
            gamerService.Delete(gamer3);

            Console.WriteLine("----------------------------");

            ICampaignService campaignService = new CampaignService();

            campaignService.Add(campaign3);
            campaignService.Delete(campaign2);
            campaignService.Update(campaign1);

            Console.WriteLine("----------------------------");

            IGameSellService gameSellService = new GameManager();

            gameSellService.Sell(gamer2, game1, campaign2);
        }