Esempio n. 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 + "}";
 }
Esempio n. 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);
 }
Esempio n. 3
0
 public string AddToPlayerInventory(List<Inventory> inventory)
 {
     var PlayerRepo = new PlayerRepository();
     PlayerRepo.AddToPlayerInventory(inventory);
     return "{'ReturnString':'Added to Player Inventory'}";
 }
Esempio n. 4
0
 public string AddItem(Item item)
 {
     var PlayerRepo = new PlayerRepository();
     PlayerRepo.AddItem(item);
     return "{'ReturnString':'Item has been created'}";
 }
Esempio n. 5
0
 public string UpdatePlayerInventory(List<Inventory> inventory)
 {
     var PlayerRepo = new PlayerRepository();
     PlayerRepo.UpdatePlayerInventory(inventory);
     return "{'ReturnString':'Updated Player Inventory'}";
 }
Esempio n. 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);
 }
Esempio n. 7
0
 public ItemType GetItemTypes()
 {
     var PlayerRepo = new PlayerRepository();
     return PlayerRepo.ItemTypes();
 }
Esempio n. 8
0
 public List<Item> GetAllItems()
 {
     var PlayerRepo = new PlayerRepository();
     return PlayerRepo.AllItems();
 }