SES-148 Endpointy dla Armor i Weapon #71
@ -97,5 +97,26 @@ namespace SessionCompanion.Controllers
|
|||||||
return new ErrorResponse() { StatusCode = 500, Message = e.Message };
|
return new ErrorResponse() { StatusCode = 500, Message = e.Message };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Metoda dodaje Weapon do danej postaci
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="characterWeaponViewModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
s426135 marked this conversation as resolved
Outdated
|
|||||||
|
[HttpPut("addWeapon")]
|
||||||
|
public async Task<Either<SuccessResponse, ErrorResponse>> AddCharacterWeapon(CharacterWeaponViewModel characterWeaponViewModel)
|
||||||
|
{
|
||||||
s426135 marked this conversation as resolved
Outdated
s426134
commented
brak return brak return
|
|||||||
|
if (!ModelState.IsValid)
|
||||||
|
return new ErrorResponse() { StatusCode = 500, Message = "Invalid model!" };
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _characterWeaponService.Create(characterWeaponViewModel);
|
||||||
|
await _characterWeaponService.SaveAsync();
|
||||||
|
return new SuccessResponse("Weapon added to character") { SuccessCode = 200 };
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return new ErrorResponse() { StatusCode = 500, Message = e.Message };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user
prosze nie mieszać języka xd