Esempio n. 1
0
        public async Task <ActionResult> Update(int accountId, [FromBody] BatteryType batteryType)
        {
            try
            {
                Guard.AgainstAccountNumberMismatch(GetAccountIdClaim(), accountId.ToString(), "userClaim.accountId", "accountId");
                var result = await _batteryService.UpdateBatteryTypeAsync(accountId, batteryType);

                return(Ok(result));
            }
            catch (ArgumentNullException)
            {
                return(BadRequest("Error with input battery type"));
            }
            catch (AccountConflictException)
            {
                return(Forbid());
            }
            catch (Exception)
            {
                return(BadRequest("Error updating battery type"));
            }
        }