示例#1
0
        public async Task <ActionResult> GetById(int accountId, int id)
        {
            try
            {
                Guard.AgainstAccountNumberMismatch(GetAccountIdClaim(), accountId.ToString(), "userClaim.accountId", "accountId");
                var batteryType = await _batteryService.GetBatteryTypeByIdAsync(accountId, id);

                return(Ok(batteryType));
            }
            catch (ArgumentNullException)
            {
                return(NotFound($"Error finding battery type {id}"));
            }
            catch (AccountConflictException)
            {
                return(Forbid());
            }
        }