SES-148 Change endpoint location
This commit is contained in:
parent
3facffb771
commit
8a7c50b307
@ -1,33 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using SessionCompanion.Services.Interfaces;
|
|
||||||
using SessionCompanion.Extensions.EitherType;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using SessionCompanion.ViewModels.ApiResponses;
|
|
||||||
|
|
||||||
namespace SessionCompanion.Controllers
|
|
||||||
{
|
|
||||||
[Route("api/characterArmor")]
|
|
||||||
[ApiController]
|
|
||||||
public class CharacterArmorController : Controller
|
|
||||||
{
|
|
||||||
private ICharacterArmorService _service;
|
|
||||||
public CharacterArmorController(ICharacterArmorService characterArmorService)
|
|
||||||
{
|
|
||||||
this._service = characterArmorService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Metoda zmienia uzywany armor danej postaci
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="characterId"></param>
|
|
||||||
/// <param name="newArmorId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<Either<ErrorResponse, SuccessResponse>> ChangeCharacterArmor(int characterId, int newArmorId)
|
|
||||||
{
|
|
||||||
return new ErrorResponse() { StatusCode = 1, Message = "asd" };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,7 @@ namespace SessionCompanion.Controllers
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public class EquipmentController : Controller
|
public class EquipmentController : Controller
|
||||||
{
|
{
|
||||||
private readonly ICharacterArmorService _characterArmorServic;
|
private readonly ICharacterArmorService _characterArmorService;
|
||||||
|
|
||||||
private readonly ICharacterOtherEquipmentService _characterOtherEquipmentService;
|
private readonly ICharacterOtherEquipmentService _characterOtherEquipmentService;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ namespace SessionCompanion.Controllers
|
|||||||
ICharacterOtherEquipmentService characterOtherEquipmentService,
|
ICharacterOtherEquipmentService characterOtherEquipmentService,
|
||||||
ICharacterWeaponService characterWeaponService)
|
ICharacterWeaponService characterWeaponService)
|
||||||
{
|
{
|
||||||
this._characterArmorServic = characterArmorService;
|
this._characterArmorService = characterArmorService;
|
||||||
this._characterOtherEquipmentService = characterOtherEquipmentService;
|
this._characterOtherEquipmentService = characterOtherEquipmentService;
|
||||||
this._characterWeaponService = characterWeaponService;
|
this._characterWeaponService = characterWeaponService;
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ namespace SessionCompanion.Controllers
|
|||||||
[HttpGet("getArmors")]
|
[HttpGet("getArmors")]
|
||||||
public async Task<Either<List<CharacterArmorViewModelDetails>, ErrorResponse>> GetCharacterArmors(int characterId)
|
public async Task<Either<List<CharacterArmorViewModelDetails>, ErrorResponse>> GetCharacterArmors(int characterId)
|
||||||
{
|
{
|
||||||
return await this._characterArmorServic.GetCharacterArmorsTaskList(characterId);
|
return await this._characterArmorService.GetCharacterArmorsTaskList(characterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -65,5 +65,37 @@ namespace SessionCompanion.Controllers
|
|||||||
return await this._characterWeaponService.GetCharacterWeaponsList(characterId);
|
return await this._characterWeaponService.GetCharacterWeaponsList(characterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Metoda zmienia uzywany armor danej postaci
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="characterId"></param>
|
||||||
|
/// <param name="newArmorId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPut("changeArmor")]
|
||||||
|
public async Task<Either<SuccessResponse, ErrorResponse>> ChangeCharacterArmor(int characterId, int newArmorId)
|
||||||
|
{
|
||||||
|
var response = await _characterArmorService.ChangeCharacterArmor(characterId, newArmorId);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Metoda dodaje Armor do danej postaci
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="characterArmorViewModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPut("addArmor")]
|
||||||
|
public async Task<Either<SuccessResponse, ErrorResponse>> AddCharacterArmor(CharacterArmorViewModel characterArmorViewModel)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _characterArmorService.Create(characterArmorViewModel);
|
||||||
|
await _characterArmorService.SaveAsync();
|
||||||
|
return new SuccessResponse("Armor added to character") { SuccessCode = 200 };
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return new ErrorResponse() { StatusCode = 500, Message = e.Message };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user