diff --git a/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterBasicStatsViewModel.cs b/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterBasicStatsViewModel.cs index 4a6eedf..eafd6ae 100644 --- a/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterBasicStatsViewModel.cs +++ b/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterBasicStatsViewModel.cs @@ -1,14 +1,25 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace SessionCompanion.ViewModels.CharacterViewModels +namespace SessionCompanion.ViewModels.CharacterViewModels { public class CharacterBasicStatsViewModel { + /// + /// Identyfikator psotaci + /// public int Id { get; set; } + + /// + /// Nazwa postaci + /// public string Name { get; set; } + + /// + /// Poziom postaci + /// public int Level { get; set; } + + /// + /// Aktualna ilość życia postaci + /// public int CurrentHealthPoints { get; set; } } } diff --git a/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterForLoginViewModel.cs b/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterForLoginViewModel.cs index dbb288e..fecc287 100644 --- a/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterForLoginViewModel.cs +++ b/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterForLoginViewModel.cs @@ -1,16 +1,30 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Text; - -namespace SessionCompanion.ViewModels.CharacterViewModels +namespace SessionCompanion.ViewModels.CharacterViewModels { public class CharacterForLoginViewModel { + /// + /// Identyfikator psotaci + /// public int Id { get; set; } + + /// + /// Id użytkownika do którego przypisana jest postać + /// public int UserId { get; set; } + + /// + /// Nazwa postaci + /// public string Name { get; set; } + + /// + /// Nazwa klasy postaci + /// public string ClassName { get; set; } + + /// + /// Poziom postaci + /// public int Level { get; set; } } } diff --git a/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterViewModel.cs b/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterViewModel.cs index 030d8bb..6b82033 100644 --- a/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterViewModel.cs +++ b/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterViewModel.cs @@ -1,13 +1,15 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Text; - -namespace SessionCompanion.ViewModels.CharacterViewModels +namespace SessionCompanion.ViewModels.CharacterViewModels { public class CharacterViewModel { + /// + /// Identyfikator psotaci + /// public int Id { get; set; } + + /// + /// Id użytkownika do którego przypisana jest postać + /// public int UserId { get; set; } } } diff --git a/SessionCompanion/SessionCompanion/Controllers/BackgroundController.cs b/SessionCompanion/SessionCompanion/Controllers/BackgroundController.cs new file mode 100644 index 0000000..443d567 --- /dev/null +++ b/SessionCompanion/SessionCompanion/Controllers/BackgroundController.cs @@ -0,0 +1,18 @@ +using Microsoft.AspNetCore.Mvc; + +using SessionCompanion.Services.Interfaces; + +namespace SessionCompanion.Controllers +{ + [Route("api/background")] + [ApiController] + public class BackgroundController : Controller + { + private readonly IBackgroundService _service; + + public BackgroundController(IBackgroundService service) + { + _service = service; + } + } +} \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/Controllers/BiographyController.cs b/SessionCompanion/SessionCompanion/Controllers/BiographyController.cs new file mode 100644 index 0000000..2b9024e --- /dev/null +++ b/SessionCompanion/SessionCompanion/Controllers/BiographyController.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Mvc; +using SessionCompanion.Services.Interfaces; + +namespace SessionCompanion.Controllers +{ + [Route("api/biography")] + [ApiController] + public class BiographyController : Controller + { + private readonly IBiographyService _service; + + public BiographyController(IBiographyService service) + { + _service = service; + } + } +} \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/Controllers/CharacterController.cs b/SessionCompanion/SessionCompanion/Controllers/CharacterController.cs new file mode 100644 index 0000000..afb6af1 --- /dev/null +++ b/SessionCompanion/SessionCompanion/Controllers/CharacterController.cs @@ -0,0 +1,33 @@ +using System.Threading.Tasks; + +using Microsoft.AspNetCore.Mvc; + +using SessionCompanion.Services.Interfaces; + +namespace SessionCompanion.Controllers +{ + using SessionCompanion.ViewModels.CharacterViewModels; + + [Route("api/character")] + [ApiController] + public class CharacterController : Controller + { + private readonly ICharacterService _service; + + public CharacterController(ICharacterService service) + { + this._service = service; + } + + /// + /// Metoda zwraca postać ze wskazanym identyfikatorem + /// + /// Identyfikator postaci + /// ViewModel Postaci + [HttpGet("{id}")] + public async Task Get(int id) + { + return await _service.Get(id); + } + } +} \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/Controllers/StatisticController.cs b/SessionCompanion/SessionCompanion/Controllers/StatisticController.cs new file mode 100644 index 0000000..09a5067 --- /dev/null +++ b/SessionCompanion/SessionCompanion/Controllers/StatisticController.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Mvc; +using SessionCompanion.Services.Interfaces; + +namespace SessionCompanion.Controllers +{ + [Route("api/statistic")] + [ApiController] + public class StatisticController : Controller + { + private readonly IStatisticsService _service; + + public StatisticController(IStatisticsService service) + { + this._service = service; + } + } +} \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/Controllers/UserController.cs b/SessionCompanion/SessionCompanion/Controllers/UserController.cs new file mode 100644 index 0000000..daedf97 --- /dev/null +++ b/SessionCompanion/SessionCompanion/Controllers/UserController.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Mvc; +using SessionCompanion.Services.Interfaces; + +namespace SessionCompanion.Controllers +{ + [Route("api/user")] + [ApiController] + public class UserController : Controller + { + private readonly IUserService _service; + + public UserController(IUserService service) + { + this._service = service; + } + } +} \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/Hubs/SessionHub.cs b/SessionCompanion/SessionCompanion/Hubs/SessionHub.cs index 9d8c7d6..f237634 100644 --- a/SessionCompanion/SessionCompanion/Hubs/SessionHub.cs +++ b/SessionCompanion/SessionCompanion/Hubs/SessionHub.cs @@ -1,9 +1,9 @@ -using Microsoft.AspNetCore.SignalR; -using System; +using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore.SignalR; + namespace SessionCompanion.Hubs { public class SessionHub : Hub @@ -23,7 +23,10 @@ namespace SessionCompanion.Hubs ConnectedCharacters.Remove(Context.ConnectionId); } else + { Groups.RemoveFromGroupAsync(Context.ConnectionId, "GameMaster"); + } + Clients.All.SendAsync("GoodBye", "Player has left the game"); return base.OnDisconnectedAsync(exception); }