getDeleteSupplierR :: SupplierId -> Handler Html
getDeleteSupplierR sId = do
  mSup <- runDB $ get sId
  case mSup of
    Just _ -> do
      a <- runDB $ selectList [BeverageSupplier ==. (Just sId)] []
      if null a
        then do
          runDB $ delete sId
          setMessageI MsgSupplierDeleted
          redirect SupplierR
        else do
          setMessageI MsgSupplierInUseError
          redirect SupplierR
    Nothing -> do
      setMessageI MsgSupplierUnknown
      redirect SupplierR
getDeleteSupplierR :: SupplierId -> Handler Html
getDeleteSupplierR sId = do
  mSup <- runDB $ get sId
  case mSup of
    Just _ -> do
      a <- runDB $ selectList [BeverageSupplier ==. (Just sId)] []
      if null a
        then do
          runDB $ delete sId
          setMessageI MsgSupplierDeleted
          redirect SupplierR
        else do
          setMessageI MsgSupplierInUseError
          redirect SupplierR
    Nothing -> do
      setMessageI MsgSupplierUnknown
      redirect SupplierR
getDeleteSupplierR sId = do
  mSup <- runDB $ get sId
  case mSup of
    Just _ -> do
      a <- runDB $ selectList [BeverageSupplier ==. (Just sId)] []
      if null a
        then do
          runDB $ delete sId
          setMessageI MsgSupplierDeleted
          redirect SupplierR
        else do
          setMessageI MsgSupplierInUseError
          redirect SupplierR
    Nothing -> do
      setMessageI MsgSupplierUnknown
      redirect SupplierR