SES-148 Implement feedback
This commit is contained in:
parent
ad92ad468b
commit
d26d9278a3
@ -41,7 +41,7 @@ namespace SessionCompanion.Services.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (armorToUse is null)
|
if (armorToUse is null)
|
||||||
return new ErrorResponse() { StatusCode = 204, Message = "No weapon to change to" };
|
return new ErrorResponse() { StatusCode = 204, Message = "No armor to change to" };
|
||||||
|
|
||||||
if (armorInUse is null)
|
if (armorInUse is null)
|
||||||
{
|
{
|
||||||
@ -50,7 +50,7 @@ namespace SessionCompanion.Services.Services
|
|||||||
{
|
{
|
||||||
await Repository.Update(armorToUse);
|
await Repository.Update(armorToUse);
|
||||||
await Repository.Save();
|
await Repository.Save();
|
||||||
return new SuccessResponse("Character weapon updated") { SuccessCode = 200 };
|
return new SuccessResponse("Character armor updated") { SuccessCode = 200 };
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -65,7 +65,7 @@ namespace SessionCompanion.Services.Services
|
|||||||
await Repository.Update(armorInUse);
|
await Repository.Update(armorInUse);
|
||||||
await Repository.Update(armorToUse);
|
await Repository.Update(armorToUse);
|
||||||
await Repository.Save();
|
await Repository.Save();
|
||||||
return new SuccessResponse("Character weapon updated") { SuccessCode = 204 };
|
return new SuccessResponse("Character armor updated") { SuccessCode = 204 };
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,6 @@ namespace SessionCompanion.Services.Services
|
|||||||
{
|
{
|
||||||
// Dodaj optional rozbro postac
|
// Dodaj optional rozbro postac
|
||||||
var allWeapons = await Repository.Get(c => c.CharacterId.Equals(model.CharacterId)).AsNoTracking().ToListAsync();
|
var allWeapons = await Repository.Get(c => c.CharacterId.Equals(model.CharacterId)).AsNoTracking().ToListAsync();
|
||||||
//var weaponsInUse = await Repository.Get(c => c.CharacterId.Equals(model.CharacterId)).Where(w => w.InUse.Equals(true)).ToListAsync();
|
|
||||||
var weaponsInUse = allWeapons.Where(w => w.InUse.Equals(true)).ToList();
|
var weaponsInUse = allWeapons.Where(w => w.InUse.Equals(true)).ToList();
|
||||||
|
|
||||||
var weapon = Mapper.Map<CharacterWeapon>(model);
|
var weapon = Mapper.Map<CharacterWeapon>(model);
|
||||||
|
@ -66,11 +66,11 @@ namespace SessionCompanion.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Metoda zmienia uzywany armor danej postaci
|
/// Metoda zmienia uzywaną zbroję danej postaci na taki jaki jest wybrany
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="characterId"></param>
|
/// <param name="characterId"> Id postaci </param>
|
||||||
/// <param name="newArmorId"></param>
|
/// <param name="newArmorId"> Id nowej zbroi </param>
|
||||||
/// <returns></returns>
|
/// <returns>SuccessResponse/ErrorResponse</returns>
|
||||||
[HttpPut("changeArmor")]
|
[HttpPut("changeArmor")]
|
||||||
public async Task<Either<SuccessResponse, ErrorResponse>> ChangeCharacterArmor(int characterId, int newArmorId)
|
public async Task<Either<SuccessResponse, ErrorResponse>> ChangeCharacterArmor(int characterId, int newArmorId)
|
||||||
{
|
{
|
||||||
@ -79,10 +79,10 @@ namespace SessionCompanion.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Metoda dodaje Armor do danej postaci
|
/// Metoda dodaje nową zbroje do danej postaci
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="characterArmorViewModel"></param>
|
/// <param name="characterArmorViewModel"> View model z odpowiednimi parameterami </param>
|
||||||
/// <returns></returns>
|
/// <returns>SuccessResponse/ErrorResponse</returns>
|
||||||
[HttpPut("addArmor")]
|
[HttpPut("addArmor")]
|
||||||
public async Task<Either<SuccessResponse, ErrorResponse>> AddCharacterArmor(CharacterArmorViewModel characterArmorViewModel)
|
public async Task<Either<SuccessResponse, ErrorResponse>> AddCharacterArmor(CharacterArmorViewModel characterArmorViewModel)
|
||||||
{
|
{
|
||||||
@ -101,10 +101,10 @@ namespace SessionCompanion.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Metoda dodaje Weapon do danej postaci
|
/// Metoda dodaje broń do danej postaci
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="characterWeaponViewModel"></param>
|
/// <param name="characterWeaponViewModel"> View model z odpowiednimi parameterami </param>
|
||||||
/// <returns></returns>
|
/// <returns>SuccessResponse/ErrorResponse</returns>
|
||||||
[HttpPut("addWeapon")]
|
[HttpPut("addWeapon")]
|
||||||
public async Task<Either<SuccessResponse, ErrorResponse>> AddCharacterWeapon(CharacterWeaponViewModel characterWeaponViewModel)
|
public async Task<Either<SuccessResponse, ErrorResponse>> AddCharacterWeapon(CharacterWeaponViewModel characterWeaponViewModel)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user