Example #1
0
 public string DeleteUserPlayer(string id)
 {
     int Id = -1;
     //make sure id is an int not string
     // ToInt32 can throw FormatException or OverflowException.
     try
     {
         Id = Convert.ToInt32(id);
     }
     catch (FormatException e)
     {
         Console.WriteLine("String ID is not a sequence of digits.");
     }
     catch (OverflowException e)
     {
         Console.WriteLine("The string ID number cannot fit in an Int32.");
     }
     var newchar = new PlayerRepository();
     newchar.DeleteUserPlayer(Id);
     var Success = 1;
     return "{'PlayerDeleted': " + Success + "}";
 }
Example #2
0
 public Player Get(string id)
 {
     int Id=-1;
     var pr = new PlayerRepository();
     //make sure id is an int not string
     // ToInt32 can throw FormatException or OverflowException.
     try
     {
         Id = Convert.ToInt32(id);
     }
     catch (FormatException e)
     {
         Console.WriteLine("String ID is not a sequence of digits.");
     }
     catch (OverflowException e)
     {
         Console.WriteLine("The string ID number cannot fit in an Int32.");
     }
     return pr.GetPlayer(Id);
     //return new Player(id);
     //var p = new PlayerRepository();
     //return p.GetPlayer(id);
 }
Example #3
0
 public string AddToPlayerInventory(List<Inventory> inventory)
 {
     var PlayerRepo = new PlayerRepository();
     PlayerRepo.AddToPlayerInventory(inventory);
     return "{'ReturnString':'Added to Player Inventory'}";
 }
Example #4
0
 public string AddItem(Item item)
 {
     var PlayerRepo = new PlayerRepository();
     PlayerRepo.AddItem(item);
     return "{'ReturnString':'Item has been created'}";
 }
Example #5
0
 public string UpdatePlayerInventory(List<Inventory> inventory)
 {
     var PlayerRepo = new PlayerRepository();
     PlayerRepo.UpdatePlayerInventory(inventory);
     return "{'ReturnString':'Updated Player Inventory'}";
 }
Example #6
0
 public List<Item> GetPlayerInventory(string playerid)
 {
     int Id = -1;
     try
     {
         Id = Convert.ToInt32(playerid);
     }
     catch (FormatException e)
     {
         Console.WriteLine("String ID is not a sequence of digits.");
     }
     catch (OverflowException e)
     {
         Console.WriteLine("The string ID number cannot fit in an Int32.");
     }
     var PlayerRepo = new PlayerRepository();
     return PlayerRepo.PlayerInventory(Id);
 }
Example #7
0
 public ItemType GetItemTypes()
 {
     var PlayerRepo = new PlayerRepository();
     return PlayerRepo.ItemTypes();
 }
Example #8
0
 public List<Item> GetAllItems()
 {
     var PlayerRepo = new PlayerRepository();
     return PlayerRepo.AllItems();
 }