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

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