Ejemplo n.º 1
0
        public async Task <ActionResult> Delete(int accountId, int id)
        {
            try
            {
                Guard.AgainstAccountNumberMismatch(GetAccountIdClaim(), accountId.ToString(), "userClaim.accountId", "accountId");
                await _batteryService.DeleteBatteryTypeAsync(accountId, id);

                return(Ok());
            }
            catch (BatteryTypeNotFoundException)
            {
                return(NotFound($"Error finding battery type {id} to delete"));
            }
            catch (AccountConflictException)
            {
                return(Forbid());
            }
            catch (Exception)
            {
                return(Conflict($"Error deleting battery type {id}"));
            }
        }