diff --git a/Back/skydiveLogs-api.Domain/Gear.cs b/Back/skydiveLogs-api.Domain/Gear.cs index 6d95a8e..2cddf55 100644 --- a/Back/skydiveLogs-api.Domain/Gear.cs +++ b/Back/skydiveLogs-api.Domain/Gear.cs @@ -13,6 +13,7 @@ public int MinSize { get; set; } public string Name { get; set; } public string ReserveCanopy { get; set; } + public string Equipment { get; set; } public User User { get; set; } diff --git a/Back/skydiveLogs-api.DomainBusiness/GearService.cs b/Back/skydiveLogs-api.DomainBusiness/GearService.cs index 2af5772..372e1bf 100644 --- a/Back/skydiveLogs-api.DomainBusiness/GearService.cs +++ b/Back/skydiveLogs-api.DomainBusiness/GearService.cs @@ -24,6 +24,10 @@ namespace skydiveLogs_api.DomainBusiness #region Public Methods + /// + /// Adds a new gear item to the system. + /// + /// The Gear entity containing the new gear data. public void AddNewGear(Gear newGear) { newGear.User = _identityService.ConnectedUser; @@ -32,11 +36,11 @@ namespace skydiveLogs_api.DomainBusiness var userId = _identityService.ConnectedUser.Id; _cacheService.Delete(CacheType.Gear, userId: userId); } - /// - /// Adds a new gear item to the system. - /// - /// The Gear entity containing the new gear data. + /// + /// Adds rental gear to the system for a new user. + /// + /// The new user for whom rental gear should be added. public void AddRentalGear(User newUser) { var rentalGear = new Gear @@ -48,25 +52,26 @@ namespace skydiveLogs_api.DomainBusiness MaxSize = 280, MinSize = 190, ReserveCanopy = "?", + Equipment = "RAS", User = newUser }; _gearRepository.Add(rentalGear); } - /// - /// Adds rental gear to the system for a new user. - /// - /// The new user for whom rental gear should be added. - public void DeleteGearById(int id) - { - throw new NotImplementedException(); - } /// /// Deletes a gear item by its ID. /// /// The gear ID to delete. + public void DeleteGearById(int id) + { + throw new NotImplementedException(); + } + /// + /// Retrieves all gear items. + /// + /// A collection of Gear entities containing all gear data. public IEnumerable GetAllGears() { var userId = _identityService.ConnectedUser.Id; @@ -78,34 +83,30 @@ namespace skydiveLogs_api.DomainBusiness return _cacheService.Get>(CacheType.Gear, userId: userId); } - /// - /// Retrieves all gear items. - /// - /// A collection of Gear entities containing all gear data. - public Gear GetGearById(int id) - { - var allGears = GetAllGears(); - return allGears.Single(g => g.Id == id); - } /// /// Retrieves a gear item by its ID. /// /// The gear ID to retrieve. /// A Gear entity containing the gear details. - - public bool UpdateGear(int id, Gear gear) + public Gear GetGearById(int id) { - gear.Id = id; - - return _gearRepository.Update(gear); + var allGears = GetAllGears(); + return allGears.Single(g => g.Id == id); } + /// /// Updates an existing gear item. /// /// The gear ID to update. /// Gear entity containing the updated gear data. /// True if the update was successful, false otherwise. + public bool UpdateGear(int id, Gear gear) + { + gear.Id = id; + + return _gearRepository.Update(gear); + } #endregion Public Methods diff --git a/Back/skydiveLogs-api/DataContract/GearReq.cs b/Back/skydiveLogs-api/DataContract/GearReq.cs index 7002497..988ef74 100644 --- a/Back/skydiveLogs-api/DataContract/GearReq.cs +++ b/Back/skydiveLogs-api/DataContract/GearReq.cs @@ -17,5 +17,7 @@ public string MainCanopy { get; set; } public string ReserveCanopy { get; set; } + + public string Equipment { get; set; } } } diff --git a/Back/skydiveLogs-api/DataContract/GearResp.cs b/Back/skydiveLogs-api/DataContract/GearResp.cs index d48fe7e..893103b 100644 --- a/Back/skydiveLogs-api/DataContract/GearResp.cs +++ b/Back/skydiveLogs-api/DataContract/GearResp.cs @@ -17,5 +17,7 @@ public string MainCanopy { get; set; } public string ReserveCanopy { get; set; } + + public string Equipment { get; set; } } }